本文整理汇总了PHP中smarty_modifier_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_modifier_truncate函数的具体用法?PHP smarty_modifier_truncate怎么用?PHP smarty_modifier_truncate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_modifier_truncate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_modifier_userlink
/**
* \brief Smarty modifier plugin to create user links with optional mouseover info
*
* - type: modifier
* - name: userlink
* - purpose: to return a user link
*
* @author
* @param string class (optional)
* @param string idletime (optional)
* @param string fullname (optional)
* @param integer max_length (optional)
* @return string user link
*
* Syntax: {$foo|userlink[:"<class>"][:"<idletime>"][:"<fullname>"][:<max_length>]} (optional params in brackets)
*
* Example: {$userinfo.login|userlink:'link':::25}
*/
function smarty_modifier_userlink($other_user, $class = 'userlink', $idletime = 'not_set', $fullname = '', $max_length = 0, $popup = 'y')
{
if (empty($other_user)) {
return "";
}
if (is_array($other_user)) {
if (count($other_user) > 1) {
$other_user = array_map(function ($username) use($class, $idletime, $popup) {
return smarty_modifier_userlink($username, $class, $idletime, '', 0, $popup);
}, $other_user);
$last = array_pop($other_user);
return tr('%0 and %1', implode(', ', $other_user), $last);
} else {
$other_user = reset($other_user);
}
}
if (!$fullname) {
$fullname = TikiLib::lib('user')->clean_user($other_user);
}
if ($max_length) {
TikiLib::lib('smarty')->loadPlugin('smarty_modifier_truncate');
$fullname = smarty_modifier_truncate($fullname, $max_length, '...', true);
}
if ($popup === 'y') {
return TikiLib::lib('user')->build_userinfo_tag($other_user, $fullname, $class);
} else {
return $fullname;
}
}
示例2: smarty_function_breadcrumbs
function smarty_function_breadcrumbs($params, $smarty)
{
$defaultParams = array('trail' => array(), 'separator' => ' > ', 'truncate' => 40);
foreach ($defaultParams as $k => $v) {
if (!isset($params[$k])) {
$params[$k] = $v;
}
}
if ($params['truncate'] > 0) {
require_once $smarty->_get_plugin_filepath('modifier', 'truncate');
}
$links = array();
$numSteps = count($params['trail']);
for ($i = 0; $i < $numSteps; $i++) {
$step = $params['trail'][$i];
if ($params['truncate'] > 0) {
$step['title'] = smarty_modifier_truncate($step['title'], $params['truncate']);
}
if (strlen($step['link']) > 0 && $i < $numSteps - 1) {
$links[] = sprintf('<a href="%s" title="%s">%s</a>', htmlspecialchars($step['link']), htmlspecialchars($step['title']), htmlspecialchars($step['title']));
} else {
$links[] = htmlspecialchars($step['title']);
}
}
return join($params['separator'], $links);
}
示例3: if
<?php if ($_valid && !is_callable('content_56059b42d6e2a')) {function content_56059b42d6e2a($_smarty_tpl) {?><?php if (!is_callable('smarty_modifier_truncate')) include '/var/www/kulturedkitsch.info/public_html/vtigercrm/libraries/Smarty/libs/plugins/modifier.truncate.php';
?>
<div class="row-fluid"><?php $_smarty_tpl->tpl_vars['EXTENSION'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['EXTENSION']->_loop = false;
$_from = $_smarty_tpl->tpl_vars['EXTENSIONS_LIST']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
$_smarty_tpl->tpl_vars['smarty']->value['foreach']['extensions']['index']=-1;
foreach ($_from as $_smarty_tpl->tpl_vars['EXTENSION']->key => $_smarty_tpl->tpl_vars['EXTENSION']->value){
$_smarty_tpl->tpl_vars['EXTENSION']->_loop = true;
$_smarty_tpl->tpl_vars['smarty']->value['foreach']['extensions']['index']++;
?><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->isAlreadyExists()){?><?php $_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['EXTENSION']->value->get('moduleModel'), null, 0);?><?php }else{ ?><?php $_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL'] = new Smarty_variable('false', null, 0);?><?php }?><div class="span6"><div class="extension_container extensionWidgetContainer"><div class="extension_header"><div class="font-x-x-large boxSizingBorderBox" style="cursor:pointer"><?php echo vtranslate($_smarty_tpl->tpl_vars['EXTENSION']->value->get('label'),$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</div><input type="hidden" name="extensionName" value="<?php echo $_smarty_tpl->tpl_vars['EXTENSION']->value->get('name');?>
" /><input type="hidden" name="moduleAction" value="<?php if (($_smarty_tpl->tpl_vars['EXTENSION']->value->isAlreadyExists())&&(!$_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL']->value->get('trial'))){?><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->isUpgradable()){?>Upgrade<?php }else{ ?>Installed<?php }?><?php }else{ ?>Install<?php }?>" /><input type="hidden" name="extensionId" value="<?php echo $_smarty_tpl->tpl_vars['EXTENSION']->value->get('id');?>
" /></div><div><div class="row-fluid extension_contents"><span class="span8"><div class="row-fluid extensionDescription" style="word-wrap:break-word;"><?php $_smarty_tpl->tpl_vars['SUMMARY'] = new Smarty_variable($_smarty_tpl->tpl_vars['EXTENSION']->value->get('summary'), null, 0);?><?php if (empty($_smarty_tpl->tpl_vars['SUMMARY']->value)){?><?php ob_start();?><?php echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['EXTENSION']->value->get('description'),100);?>
<?php $_tmp1=ob_get_clean();?><?php $_smarty_tpl->tpl_vars['SUMMARY'] = new Smarty_variable($_tmp1, null, 0);?><?php }?><?php echo $_smarty_tpl->tpl_vars['SUMMARY']->value;?>
</div></span><span class="span4"><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->get('thumbnailURL')!=null){?><?php $_smarty_tpl->tpl_vars['imageSource'] = new Smarty_variable($_smarty_tpl->tpl_vars['EXTENSION']->value->get('thumbnailURL'), null, 0);?><?php }else{ ?><?php $_smarty_tpl->tpl_vars['imageSource'] = new Smarty_variable(vimage_path('unavailable.png'), null, 0);?><?php }?><img class="thumbnailImage" src="<?php echo $_smarty_tpl->tpl_vars['imageSource']->value;?>
"/></span></div><div class="extensionInfo"><div class="row-fluid"><?php $_smarty_tpl->tpl_vars['ON_RATINGS'] = new Smarty_variable($_smarty_tpl->tpl_vars['EXTENSION']->value->get('avgrating'), null, 0);?><div class="span4"><span class="rating" data-score="<?php echo $_smarty_tpl->tpl_vars['ON_RATINGS']->value;?>
" data-readonly=true></span><span><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->get('avgrating')){?> (<?php echo $_smarty_tpl->tpl_vars['EXTENSION']->value->get('avgrating');?>
)<?php }?></span></div><div class="span8"><div class="pull-right"><button class="btn installExtension addButton" style="margin-right:5px;"><?php echo vtranslate('LBL_MORE_DETAILS',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</button><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->isVtigerCompatible()){?><?php if (($_smarty_tpl->tpl_vars['EXTENSION']->value->isAlreadyExists())&&(!$_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL']->value->get('trial'))){?><?php if (($_smarty_tpl->tpl_vars['EXTENSION']->value->isUpgradable())){?><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->get('isprotected')&&$_smarty_tpl->tpl_vars['IS_PRO']->value){?><button class="oneclickInstallFree btn btn-success margin0px <?php if (($_smarty_tpl->tpl_vars['REGISTRATION_STATUS']->value)&&($_smarty_tpl->tpl_vars['PASSWORD_STATUS']->value)){?>authenticated <?php }else{ ?> loginRequired<?php }?>"><?php echo vtranslate('LBL_UPGRADE',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</button><?php }elseif(!$_smarty_tpl->tpl_vars['EXTENSION']->value->get('isprotected')){?><button class="oneclickInstallFree btn btn-success margin0px <?php if (($_smarty_tpl->tpl_vars['REGISTRATION_STATUS']->value)&&($_smarty_tpl->tpl_vars['PASSWORD_STATUS']->value)){?>authenticated <?php }else{ ?> loginRequired<?php }?>"><?php echo vtranslate('LBL_UPGRADE',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</button><?php }?><?php }else{ ?><span class="alert alert-info" style="vertical-align:middle; padding: 5px 10px;"><?php echo vtranslate('LBL_INSTALLED',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</span><?php }?><?php }elseif((($_smarty_tpl->tpl_vars['EXTENSION']->value->get('price')=='Free')||($_smarty_tpl->tpl_vars['EXTENSION']->value->get('price')==0))){?><?php if ($_smarty_tpl->tpl_vars['EXTENSION']->value->get('isprotected')&&$_smarty_tpl->tpl_vars['IS_PRO']->value){?><button class="oneclickInstallFree btn btn-success <?php if (($_smarty_tpl->tpl_vars['REGISTRATION_STATUS']->value)&&($_smarty_tpl->tpl_vars['PASSWORD_STATUS']->value)){?>authenticated <?php }else{ ?> loginRequired<?php }?>"><?php echo vtranslate('LBL_INSTALL',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</button><?php }elseif(!$_smarty_tpl->tpl_vars['EXTENSION']->value->get('isprotected')){?><button class="oneclickInstallFree btn btn-success <?php if (($_smarty_tpl->tpl_vars['REGISTRATION_STATUS']->value)&&($_smarty_tpl->tpl_vars['PASSWORD_STATUS']->value)){?>authenticated <?php }else{ ?> loginRequired<?php }?>"><?php echo vtranslate('LBL_INSTALL',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</button><?php }?><?php }elseif(($_smarty_tpl->tpl_vars['IS_PRO']->value)){?><?php if (($_smarty_tpl->tpl_vars['EXTENSION']->value->get('trialdays')>0)&&($_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL']->value=='false')&&($_smarty_tpl->tpl_vars['EXTENSION']->value->get('isprotected')==1)){?><button class="oneclickInstallPaid btn btn-success <?php if (($_smarty_tpl->tpl_vars['REGISTRATION_STATUS']->value)&&($_smarty_tpl->tpl_vars['PASSWORD_STATUS']->value)){?>authenticated <?php }else{ ?> loginRequired<?php }?>" data-trial=true><?php echo vtranslate('LBL_TRY_IT',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</button><?php }elseif((($_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL']->value!='false')&&($_smarty_tpl->tpl_vars['EXTENSION_MODULE_MODEL']->value->get('trial')))){?><span class="alert alert-info"><?php echo vtranslate('LBL_TRIAL_INSTALLED',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</span> <?php }?><button class="oneclickInstallPaid btn btn-info <?php if (($_smarty_tpl->tpl_vars['REGISTRATION_STATUS']->value)&&($_smarty_tpl->tpl_vars['PASSWORD_STATUS']->value)){?>authenticated <?php }else{ ?> loginRequired<?php }?>" data-trial=false><?php echo vtranslate('LBL_BUY',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
$<?php echo $_smarty_tpl->tpl_vars['EXTENSION']->value->get('price');?>
</button><?php }?><?php }else{ ?><span class="alert alert-error"><?php echo vtranslate('LBL_EXTENSION_NOT_COMPATABLE',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</span><?php }?></div></div></div></div></div></div></div><?php if ($_smarty_tpl->getVariable('smarty')->value['foreach']['extensions']['index']%2!=0){?></div><div class="row-fluid"><?php }?><?php } ?><?php if (empty($_smarty_tpl->tpl_vars['EXTENSIONS_LIST']->value)){?><table class="emptyRecordsDiv"><tbody><tr><td><?php echo vtranslate('LBL_NO_EXTENSIONS_FOUND',$_smarty_tpl->tpl_vars['QUALIFIED_MODULE']->value);?>
</td></tr></tbody></table><?php }?></div><?php }} ?>
开发者ID:jeremyevans6,项目名称:kulturedTiger-,代码行数:29,代码来源:d6ff856468fc449f2bbd5816c87da1afc4a350fd.file.ExtensionModules.tpl.php
示例4: smarty_modifier_html_truncate
/**
* Truncates a string with the HTML structure in mind, so it won't truncate inside of tags and all tags will be closed.
* In the end there will be $length characters output with valid html formatting for them, that also means that the
* real length will be greather than (or equal if no HTML) to the $length.
*
* @package FeM\sPof\template\smartyPlugins
* @author dangerground
* @since 1.0
*
* @api
*
* @param string $string
* @param int $length (optional)
* @param string $etc (optional)
* @param bool $break_words (optional)
* @param bool $middle (optional)
*
* @return string
*/
function smarty_modifier_html_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
{
require_once SMARTY_PLUGINS_DIR . 'modifier.truncate.php';
if ($length == 0) {
return '';
}
// strlen > $length
if (!isset($string[$length])) {
return $string;
}
// use original modifier when possible
if (strpos($string, '<') === false) {
return smarty_modifier_truncate($string, $length, $etc, $break_words, $middle);
}
// would it be short enough if we drop the tags from count?
if (!isset(strip_tags($string)[$length])) {
return $string;
}
// calculate the position to calculate the length and truncate using original function
$parts = preg_split('#(<[^>]+>)#', $string, -1, PREG_SPLIT_OFFSET_CAPTURE | PREG_SPLIT_DELIM_CAPTURE);
$reallength = 0;
$taglength = 0;
$lastpos = 0;
foreach ($parts as $part) {
$len = $part[1] - $lastpos;
if (strpos($part[0], '<') === 0) {
$reallength += $len;
} else {
$taglength += $len;
}
$lastpos = $part[1];
if ($reallength >= $length) {
$string = smarty_modifier_truncate($string, $length + $taglength, $etc, $break_words, $middle);
break;
}
}
// get all opening tags
preg_match_all('#<([^/][^>]*)>#i', $string, $start_tags);
$start_tags = $start_tags[1];
// get all closing tags
preg_match_all('#</([a-z]+)>#i', $string, $end_tags);
$end_tags = $end_tags[1];
// gather tags that need to be closed
$need_close = [];
foreach ($start_tags as $tag) {
$pos = array_search($tag, $end_tags);
if ($pos !== false) {
unset($end_tags[$pos]);
} else {
$need_close[] = $tag;
}
}
// foreach
// close all remaining open tags in reverse order
$need_close = array_reverse($need_close);
foreach ($need_close as $tag) {
$string .= '</' . $tag . '>';
}
return $string;
}
示例5: content_56689b325bfb56_72647711
function content_56689b325bfb56_72647711($_smarty_tpl)
{
if (!is_callable('smarty_modifier_truncate')) {
require_once '/home/ubuntu/workspace/resources/library/external/smarty/libs/plugins/modifier.truncate.php';
}
if (!is_callable('smarty_modifier_capitalize')) {
require_once '/home/ubuntu/workspace/resources/library/external/smarty/libs/plugins/modifier.capitalize.php';
}
$_smarty_tpl->properties['nocache_hash'] = '193598146556689b32596490_76979314';
?>
<div class="card deck-card">
<div class="deck-icon">
<i class="fa fa-4x <?php
echo $_smarty_tpl->tpl_vars['icon']->value;
?>
"></i>
</div>
<div class="deck-title">
<?php
echo mb_convert_encoding(htmlspecialchars($_smarty_tpl->tpl_vars['name']->value, ENT_QUOTES, 'UTF-8', true), "HTML-ENTITIES", 'UTF-8');
?>
</div>
<div class="deck-description">
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['description']->value, 256);
?>
</div>
<div class="deck_dropdown dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
Deck Action
<i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu">
<li><a href="view_deck.php?deckid=<?php
echo $_smarty_tpl->tpl_vars['deckid']->value;
?>
">View Deck</a></li>
<?php
if ($_smarty_tpl->tpl_vars['userid']->value == $_SESSION['userid']) {
?>
<li><a href="edit_deck.php?deckid=<?php
echo $_smarty_tpl->tpl_vars['deckid']->value;
?>
">Edit Deck</a></li>
<?php
}
?>
<li><a href="browse_decks.php?userid=<?php
echo $_smarty_tpl->tpl_vars['userid']->value;
?>
">Browse <?php
echo smarty_modifier_capitalize($_smarty_tpl->tpl_vars['usercopename']->value);
?>
's Decks</a></li>
</ul>
</div>
</div><?php
}
开发者ID:PercyODI,项目名称:copeappgames,代码行数:60,代码来源:69e329f43f4a1d8934699a941cd8a6565db1191d_0.file.deck_card.tpl.php
示例6: smarty_function_breadcrumbs
/**
* Get the path to the resource as (breadcrumbs)
*
* @param array $params
* @param Smarty $smarty
*
* @return string
*/
function smarty_function_breadcrumbs($params, $smarty)
{
$defaultParams = array('trail' => array(), 'separator' => ' > ', 'truncate' => 40);
// initialize the parameters
foreach ($defaultParams as $k => $v) {
if (!isset($params[$k])) {
$params[$k] = $v;
}
}
// load the truncate modifier
if ($params['truncate'] > 0) {
require_once $smarty->_get_plugin_filepath('modifier', 'truncate');
}
$links = array();
$numSteps = count($params['trail']);
for ($i = 0; $i < $numSteps; $i++) {
$step = $params['trail'][$i];
// truncate the title if required
if ($params['truncate'] > 0) {
$step['title'] = smarty_modifier_truncate($step['title'], $params['truncate']);
}
// build the link if it's set and isn't the last step
if (strlen($step['link']) > 0 && $i < $numSteps - 1) {
$links[] = sprintf('<a href="%s" title="%s">%s</a>', htmlSpecialChars($step['link']), htmlSpecialChars($step['title']), htmlSpecialChars($step['title']));
} else {
// either the link isn't set, or it's the last step
$links[] = htmlSpecialChars($step['title']);
}
}
// join the links using the specified separator
return join($params['separator'], $links);
}
示例7: smarty_modifier_truncatehtml
function smarty_modifier_truncatehtml($html, $limit = 80, $endchar = '…')
{
try {
$output = new TruncateHtmlString(html_entity_decode(preg_replace('#<([bh]r)>#', '<$1/>', $html), ENT_HTML5 | ENT_QUOTES), $limit, html_entity_decode($endchar));
return $output->cut();
} catch (Exception $e) {
// parsing error
return smarty_modifier_truncate(preg_replace('#<[^>]+>#', ' ', $html), $limit, $endchar);
}
}
示例8: renderInnerOutput
function renderInnerOutput($context = array())
{
$output = parent::renderInnerOutput($context);
if (!empty($context['list_mode']) && $context['list_mode'] === 'y' && $this->getOption('listmax')) {
TikiLib::lib('smarty')->loadPlugin('smarty_modifier_truncate');
return smarty_modifier_truncate(strip_tags($output), $this->getOption('listmax'));
} else {
return $output;
}
}
示例9: content_5589dffbdfece7_86746829
function content_5589dffbdfece7_86746829($_smarty_tpl)
{
if (!is_callable('smarty_modifier_truncate')) {
include 'C:\\AppServ\\www\\play_huico\\trunk\\application\\libs\\plugins\\modifier.truncate.php';
}
if (isset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1'])) {
unset($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']);
}
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['name'] = 'sec1';
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'] = is_array($_loop = $_smarty_tpl->tpl_vars['arrayAlbums']->value) ? count($_loop) : max(0, (int) $_loop);
unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'] - 1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show']) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['loop'];
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] == 0) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show'] = false;
}
} else {
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'] = 0;
}
if ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['show']) {
for ($_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] = 1; $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total']; $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration']++) {
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['first'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] == 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['last'] = $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']['sec1']['total'];
?>
<div class="bloc" name="bloc">
<div class="linkAlbum"><a href="displayPlaylist.php?albumID=<?php
echo $_smarty_tpl->tpl_vars['arrayAlbums']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['id'];
?>
" target="_top"><img class="albumcover" src="<?php
echo $_smarty_tpl->tpl_vars['arrayAlbums']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['cover'];
?>
"></a></div>
<div class="linkAlbum"><a href="displayPlaylist.php?albumID=<?php
echo $_smarty_tpl->tpl_vars['arrayAlbums']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['id'];
?>
" target="_top"><?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['arrayAlbums']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['title'], 40);
?>
</a><br />
<span class="albumArtist"><?php
echo $_smarty_tpl->tpl_vars['arrayAlbums']->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec1']['index']]['tracksCount'];
?>
track(s)</span></div>
</div>
<?php
}
}
}
开发者ID:huicochea,项目名称:play_huico,代码行数:55,代码来源:d973c50cf0a579c13d1144a6259debcf288327be.file.displayAlbums.tpl.cache.php
示例10: content_56689b75184110_43731070
function content_56689b75184110_43731070($_smarty_tpl)
{
if (!is_callable('smarty_modifier_truncate')) {
require_once '/home/ubuntu/workspace/resources/library/external/smarty/libs/plugins/modifier.truncate.php';
}
$_smarty_tpl->properties['nocache_hash'] = '151625489656689b75159534_19225502';
?>
<div class="card game-card">
<div class="game-icon">
<i class="fa fa-4x <?php
echo $_smarty_tpl->tpl_vars['icon']->value;
?>
"></i>
</div>
<div class="game-title">
<?php
echo $_smarty_tpl->tpl_vars['title']->value;
?>
</div>
<div class="game-description">
<?php
echo smarty_modifier_truncate(preg_replace('!<[^>]*?>!', ' ', $_smarty_tpl->tpl_vars['description']->value), 256);
?>
</div>
<div class="game_dropdown dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
Game Action
<i class="fa fa-caret-down"></i>
</button>
<ul class="dropdown-menu">
<li><a href="view_game.php?gameid=<?php
echo $_smarty_tpl->tpl_vars['gameid']->value;
?>
">View Game</a></li>
<?php
if ($_smarty_tpl->tpl_vars['userid']->value == $_SESSION['userid']) {
?>
<li><a href="edit_game.php?gameid=<?php
echo $_smarty_tpl->tpl_vars['gameid']->value;
?>
">Edit Game</a></li>
<?php
}
?>
</ul>
</div>
</div><?php
}
开发者ID:PercyODI,项目名称:copeappgames,代码行数:50,代码来源:c3c7d8767593f9d47819bca95a4cf2982d30b2c1_0.file.game_card.tpl.php
示例11: content_559878bd6698f6_96114937
function content_559878bd6698f6_96114937($_smarty_tpl)
{
if (!is_callable('smarty_modifier_truncate')) {
include 'D:\\WWW\\ecshoptk\\ThinkPHP\\Library\\Vendor\\Smarty\\plugins\\modifier.truncate.php';
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<ul>
<?php
$_smarty_tpl->tpl_vars['article'] = new Smarty_Variable();
$_smarty_tpl->tpl_vars['article']->_loop = false;
$_from = $_smarty_tpl->tpl_vars['new_articles']->value;
if (!is_array($_from) && !is_object($_from)) {
settype($_from, 'array');
}
foreach ($_from as $_smarty_tpl->tpl_vars['article']->key => $_smarty_tpl->tpl_vars['article']->value) {
$_smarty_tpl->tpl_vars['article']->_loop = true;
?>
<li>
[<a href="<?php
echo $_smarty_tpl->tpl_vars['article']->value['cat_url'];
?>
"><?php
echo $_smarty_tpl->tpl_vars['article']->value['cat_name'];
?>
</a>] <a href="<?php
echo $_smarty_tpl->tpl_vars['article']->value['url'];
?>
" title="<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['article']->value['title'], ENT_QUOTES, 'UTF-8', true);
?>
"><?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['article']->value['short_title'], 10, "...", true);
?>
</a>
</li>
<?php
}
?>
</ul><?php
}
开发者ID:highestgoodlikewater,项目名称:ecshoptk,代码行数:41,代码来源:5d4d6140e1ae5f6271f9c249c3f62b51b8f92322.file.new_articles.lbi.php
示例12: listData
/**
* Data used in index listing.
* @return array
*/
protected function listData()
{
$sql = "is_visible = ? ORDER BY position";
/** @var \RedBean_SimpleModel[] $instanceBeans */
$instanceBeans = R::findAll('setting', $sql, array(true));
$instanceRows = array();
if (!empty($instanceBeans)) {
$this->app->getTemplateEngine()->loadPlugin('smarty_modifier_truncate', true);
foreach ($instanceBeans as $instanceBean) {
/** @var \TestApp\Models\Setting $instance */
$instance = $instanceBean->box();
$actions = array('data' => '<a title="View" href="' . $this->app->getRouter()->getUrl('admin/settings/edit', array('id' => $instance->get('id'))) . '" data-toggle="dialog"><span class="icon-pencil"></span></a>', 'class' => 'TAC');
if ($instance->get('input_type') == 'password') {
$value = '********';
} else {
$value = smarty_modifier_truncate($instance->getDisplayValue(), 40, '...', true);
}
$instanceRow = array($instance->get('name'), $value, $actions, $instance->get('position'));
$instanceRows[] = $instanceRow;
}
}
return $instanceRows;
}
示例13: smarty_function_arrayJoin
function smarty_function_arrayJoin($params, &$smarty)
{
/*
param array(array,required): array that members will be joined
param glue(string,required): glue of join
param truncate_each(integer,optional): if set, truncate each member to this length
param truncate(integer,optional): if set, truncate the result string to this length
*/
require_once $smarty->_get_plugin_filepath('modifier', 'truncate');
$arr = $params["array"];
if (isset($params["truncate_each"])) {
$new_arr = array();
foreach ($arr as $member) {
$new_arr[] = smarty_modifier_truncate($member, $params["truncate_each"], "", true);
}
$arr = $new_arr;
}
$str = join($arr, $params["glue"]);
if (isset($params["truncate"])) {
$str = smarty_modifier_truncate($str, $params["truncate"], "...", false);
}
return $str;
}
示例14: smarty_function_breadcrumbs
function smarty_function_breadcrumbs($params, $smarty)
{
$defaultParams = array('trail' => array(), 'separator' => ' > ', 'truncate' => 40);
//echo "<br/>params count: ".count($params)."<br/>";
foreach ($params as $k => $v) {
if (isset($params[$k])) {
$params[$k] = $v;
//echo "params[k]: ".$params[$k]."<br/>";
}
}
//load the truncate modifier
if ($params['truncate'] > 0) {
require_once $smarty->_get_plugin_filepath('modifier', 'truncate');
}
$links = array();
$numSteps = count($params['trail']);
//echo "current numSteps are: ".$numSteps."<br/>";
for ($i = 0; $i < $numSteps; $i++) {
//echo "numSteps in for loops: ".$numSteps."<br>";
$step = $params['trail'][$i];
//echo "the step are here: ".$step['title'];
//echo "the link are here: ".$step['link'];
//truncate the title if required
if ($params['truncate'] > 0) {
$step['title'] = smarty_modifier_truncate($step['title'], $params['truncate']);
}
//build the link if it's set and isn't the last step
if (strlen($step['link']) > 0 && $i < $numSteps - 1) {
$link[] = sprintf('<a href="%s" title="%s">%s</a>', htmlSpecialChars($step['link']), htmlSpecialChars($step['title']), htmlSpecialChars($step['title']));
} else {
$link[] = htmlSpecialChars($step['title']);
}
//join the links using the specified separator
}
//echo $params['separator'];
return join(' » ', $link);
}
示例15: content_5662b1dc686117_41510784
function content_5662b1dc686117_41510784($_smarty_tpl)
{
if (!is_callable('smarty_modifier_truncate')) {
require_once 'C:\\xampp\\htdocs\\smarty\\libs\\plugins\\modifier.truncate.php';
}
$_smarty_tpl->properties['nocache_hash'] = '13245662b1dc605274_11045655';
echo $_smarty_tpl->tpl_vars['articleTitle']->value;
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value);
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value, 30);
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value, 30, '');
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value, 30, "---");
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value, 30, '', true);
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value, 30, "...", true);
?>
<?php
echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['articleTitle']->value, 30, '..', true, true);
}
开发者ID:SUDIP2222,项目名称:Smarty-Basic,代码行数:36,代码来源:da43ef9346a5bc32389b7418d7989661fabe5a37_0.file.index.tpl.php