• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Smarty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Smarty的典型用法代码示例。如果您正苦于以下问题:PHP Smarty类的具体用法?PHP Smarty怎么用?PHP Smarty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Smarty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ShowSearchForm

function ShowSearchForm(VirgoAPI $api, Smarty $smarty, $lng)
{
    $smarty->assign("ShowSearchForm", true);
    $smarty->assign("provinces", $api->GetInvestmentsProvinces($lng));
    $smarty->assign("categories", $api->GetInvestmentsCategories($lng));
    $smarty->assign("post", $_POST);
}
开发者ID:uirapuru,项目名称:virgoapi,代码行数:7,代码来源:index_i.php


示例2: smarty_function_filegal_uploader

/** filegal_uploader: Adds a widget to the page to upload files
 *
 * @param array $params
 *     'galleryId' => int	file gallery to upload into by default
 *
 * @param Smarty $smarty
 * @return string html
 */
function smarty_function_filegal_uploader($params, $smarty)
{
    $headerlib = TikiLib::lib('header');
    //	Image loader and canvas libs
    $headerlib->add_jsfile('vendor/blueimp/javascript-load-image/js/load-image.all.min.js');
    $headerlib->add_jsfile('vendor/blueimp/javascript-canvas-to-blob/js/canvas-to-blob.min.js');
    //	The Iframe Transport is required for browsers without support for XHR file uploads
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js');
    //	The basic File Upload plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js');
    //	The File Upload processing plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-process.js');
    //	The File Upload image preview & resize plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-image.js');
    //	The File Upload audio preview plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-audio.js');
    //	The File Upload video preview plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-video.js');
    //	The File Upload validation plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-validate.js');
    //	The File Upload user interface plugin
    $headerlib->add_jsfile('vendor/blueimp/jquery-file-upload/js/jquery.fileupload-ui.js');
    // CSS
    $headerlib->add_cssfile('vendor/blueimp/jquery-file-upload/css/jquery.fileupload.css');
    $headerlib->add_cssfile('vendor/blueimp/jquery-file-upload/css/jquery.fileupload-ui.css');
    //	Tiki customised application script
    $headerlib->add_jsfile('lib/jquery_tiki/tiki-jquery_upload.js');
    $return = $smarty->fetch('file/jquery_upload.tpl');
    return $return;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:38,代码来源:function.filegal_uploader.php


示例3: smarty_block_copixhtmlheader

/**
 * Permet au concepteur de template d'ajouter des éléments censés apparaitre dans la partie
 * <head> du template HTML.
 *
 * Params:   kind: string (jsLink, cssLink, style, others, jsCode)
 *
 * @param		array	$params		tableau des paramètres passés à la balise
 * @param		string	$content	contenu du block
 * @param		Smarty	$smarty		pointeur sur l'élement smarty
 * @return		string
 *
 * <code>
 * {copixhtmlheader kind=JsCode}
 * var variable = "{$maVariableValue}";
 * {/copixhtmlheader}
 * </code>
 */
function smarty_block_copixhtmlheader($params, $content, &$smarty)
{
    if (is_null($content)) {
        return;
    }
    //Si aucun type n'a été demandé, on utilise others par défaut.
    $kind = isset($params['kind']) ? strtolower($params['kind']) : 'others';
    $key = isset($params['key']) ? $params['key'] : null;
    $funcName = 'add' . $kind;
    switch ($kind) {
        case 'jscode':
        case 'jsdomreadycode':
        case 'others':
            CopixHTMLHeader::$funcName($content, $key);
            break;
        case 'jslink':
        case 'csslink':
            foreach (array_filter(array_map('trim', explode("\n", $content))) as $line) {
                if (strlen(trim($line)) > 0) {
                    CopixHTMLHeader::$funcName($line);
                }
            }
            break;
        case 'style':
        case 'others':
            CopixHTMLHeader::$funcName($content);
            break;
        default:
            $smarty->_trigger_fatal_error("[plugin copixhtmlheader] unknow kind " . $params['kind'] . ", only jsLink, cssLink, style, others, jsCode are available");
    }
    return '';
}
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:49,代码来源:block.copixhtmlheader.php


示例4: clearCache

 /**
  * Empty cache for a specific template
  *
  * @api  Smarty::clearCache()
  * @link http://www.smarty.net/docs/en/api.clear.cache.tpl
  *
  * @param \Smarty  $smarty
  * @param  string  $template_name template name
  * @param  string  $cache_id      cache id
  * @param  string  $compile_id    compile id
  * @param  integer $exp_time      expiration time
  * @param  string  $type          resource type
  *
  * @return integer number of cache files deleted
  */
 public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
 {
     $smarty->_clearTemplateCache();
     // load cache resource and call clear
     $_cache_resource = Smarty_CacheResource::load($smarty, $type);
     return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
 }
开发者ID:yanlyan,项目名称:si_ibuhamil,代码行数:22,代码来源:smarty_internal_method_clearcache.php


示例5: compile_CFG

function compile_CFG($prop)
{
    $smarty = new Smarty();
    $smarty->assign($prop);
    $string = $smarty->fetch(dirname(__FILE__) . '/compile.tpl');
    return $string;
}
开发者ID:awwthentic1234,项目名称:hey,代码行数:7,代码来源:shut_down.php


示例6: setUp

 public function setUp()
 {
     $smarty = new Smarty();
     $render = new CM_Frontend_Render();
     $this->_template = $smarty->createTemplate('string:');
     $this->_template->assignGlobal('render', $render);
 }
开发者ID:cargomedia,项目名称:cm,代码行数:7,代码来源:block.contentPlaceholderTest.php


示例7: smarty_function_mobile_access_paginator

/**
 * Render pagination block
 * 
 * Parameters:
 * 
 * - page - current_page
 * - total_pages - total pages
 * - route - route for URL assembly
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_mobile_access_paginator($params, &$smarty)
{
    $url_params = '';
    if (is_foreachable($params)) {
        foreach ($params as $k => $v) {
            if (strpos($k, 'url_param_') !== false && $v) {
                $url_params .= '&amp;' . substr($k, 10) . '=' . $v;
            }
            // if
        }
        // foreach
    }
    // if
    $paginator = array_var($params, 'paginator', new Pager());
    $paginator_url = array_var($params, 'url', ROOT_URL);
    $paginator_anchor = array_var($params, 'anchor', '');
    $smarty->assign(array("_mobile_access_paginator_url" => $paginator_url, "_mobile_access_paginator" => $paginator, '_mobile_access_paginator_anchor' => $paginator_anchor, "_mobile_access_paginator_url_params" => $url_params));
    $paginator_url = strpos($paginator_url, '?') === false ? $paginator_url . '?' : $paginator_url . '&';
    if (!$paginator->isFirst()) {
        $smarty->assign('_mobile_access_paginator_prev_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() - 1) . $url_params . $paginator_anchor);
    }
    // if
    if (!$paginator->isLast()) {
        $smarty->assign('_mobile_access_paginator_next_url', $paginator_url . 'page=' . ($paginator->getCurrentPage() + 1) . $url_params . $paginator_anchor);
    }
    // if
    return $smarty->fetch(get_template_path('_paginator', null, MOBILE_ACCESS_MODULE));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:41,代码来源:function.mobile_access_paginator.php


示例8: doDefault

 /**
  * 显示登录页(默认Action)
  */
 function doDefault()
 {
     $base = dirname(__FILE__);
     // 初始化smarty
     import('smarty.Smarty');
     $smarty = new Smarty();
     $smarty->template_dir = $this->app->cfg['smarty']['template_dir'];
     $smarty->compile_dir = $this->app->cfg['smarty']['compile_dir'];
     $smarty->config_dir = $this->app->cfg['smarty']['config_dir'];
     $smarty->cache_dir = $this->app->cfg['smarty']['cache_dir'];
     $smarty->debugging = $this->app->cfg['smarty']['debugging'];
     $smarty->caching = $this->app->cfg['smarty']['caching'];
     $smarty->cache_lifetime = $this->app->cfg['smarty']['cache_lifetime'];
     $smarty->left_delimiter = '{<';
     $smarty->right_delimiter = '>}';
     $result = null;
     if (isset($_POST['u']) && isset($_POST['p'])) {
         //$password 是从数据库中读取的用户密码,现在暂定hello
         $password = "hello";
         //计算密码和验证码的md5值
         if (md5($password . $_SESSION['VALIDATE_CODE']) == $_POST['p']) {
             $result = "The result is: right";
         } else {
             $result = "The result is: false";
         }
     }
     $smarty->assign("result", $result);
     $smarty->display($base . "\\md5demo.tpl");
 }
开发者ID:sanplit,项目名称:huishou,代码行数:32,代码来源:md5demo.php


示例9: _renderForm

 function _renderForm(&$page)
 {
     $pageName = $page->getAttribute('name');
     $tabPreview = array_slice($page->controller->_tabs, -2, 1);
     // setup a template object
     $tpl = new Smarty();
     $tpl->template_dir = './templates';
     $tpl->compile_dir = './templates_c';
     // on preview tab, add progress bar javascript and stylesheet
     if ($pageName == $tabPreview[0][0]) {
         $bar = $page->controller->createProgressBar();
         $tpl->assign(array('qf_style' => $bar->getStyle(), 'qf_script' => $bar->getScript()));
         $barElement = $page->getElement('progressBar');
         $barElement->setText($bar->toHtml());
     }
     $renderer = new HTML_QuickForm_Renderer_Array(true);
     $page->accept($renderer);
     $tpl->assign('form', $renderer->toArray());
     // capture the array stucture
     // (only for showing in sample template)
     ob_start();
     print_r($renderer->toArray());
     $tpl->assign('dynamic_array', ob_get_contents());
     ob_end_clean();
     $tpl->display('smarty-dynamic.tpl');
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:26,代码来源:SmartyDynamic.php


示例10: admin_joinus

function admin_joinus()
{
    global $db, $countries;
    $tpl = new smarty();
    $db->query('SELECT tname, `joinID`, `name`, b.username, b.email, b.icq, b.msn, `age`, b.country, `teamID`, `comment`, `IP`, `datum`, `closed`, `closedby`, a.username as closedby_username FROM ' . DB_PRE . 'ecp_joinus as b LEFT JOIN ' . DB_PRE . 'ecp_teams ON (teamID = tID) LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (ID=closedby) ORDER BY closed ASC, datum ASC');
    $joinus = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(SHORT_DATE, $row['datum']);
        if ($row['joinID'] == (int) @$_GET['id']) {
            $spe = $row;
        }
        $joinus[] = $row;
    }
    if (@$spe) {
        ob_start();
        $tpl1 = new Smarty();
        foreach ($spe as $key => $value) {
            $tpl1->assign($key, $value);
        }
        $tpl1->assign('countryname', $countries[$spe['country']]);
        $tpl1->assign('id', $row['joinID']);
        $tpl1->display(DESIGN . '/tpl/admin/joinus_view.html');
        $tpl->assign('details', ob_get_contents());
        ob_end_clean();
    }
    $tpl->assign('joinus', $joinus);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/joinus.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(JOINUS, $content, '', 1);
}
开发者ID:ECP-Black,项目名称:ECP,代码行数:32,代码来源:joinus.php


示例11: __construct

 private function __construct()
 {
     $mode = isset($_GET['mode']) ? $_GET['mode'] : false;
     require 'core/models/class.Access.php';
     switch ($mode) {
         case 'login':
             $login = new Access();
             $login->Login();
             break;
         case 'reg':
             if (isset($_POST['faccion'])) {
                 $reg = new Access();
                 $reg->Register();
             } else {
                 $lng = new Lang();
                 $template = new Smarty();
                 $template->assign(array('x_user' => $lng->x_user, 'x_pass' => $lng->x_pass, 'x_email' => $lng->x_email, 'x_registrarme' => $lng->x_registrarme));
                 $template->display('public/registro.xnv');
             }
             break;
         default:
             $lng = new Lang();
             $template = new Smarty();
             $template->assign(array('x_user' => $lng->x_user, 'x_pass' => $lng->x_pass, 'x_recordar' => $lng->x_recordar, 'x_submit' => $lng->x_submit));
             $template->display('public/index.xnv');
             break;
     }
     unset($lng, $template);
 }
开发者ID:Nykus,项目名称:xnova,代码行数:29,代码来源:indexController.php


示例12: smarty_function_get_favorites

/**
 * Smarty {get_favorites} function plugin
 *
 * Type:     function<br>
 * Name:     get_favorites<br>
 * Purpose:  get and assign favorites
 *
 * @param         $params
 * @param \Smarty $smarty
 * @return bool
 */
function smarty_function_get_favorites($params, &$smarty)
{
    global $user;
    $uid = empty($params['user_id']) ? $user->id : $params['user_id'];
    $id = empty($params['id']) ? null : $params['id'];
    $smarty->assign($params['assign'], favorites::get($params['module'], $id, $uid));
}
开发者ID:notzen,项目名称:exponent-cms,代码行数:18,代码来源:function.get_favorites.php


示例13: smarty_function_oxscript

/**
 * Smarty plugin
 * -------------------------------------------------------------
 * File: function.oxscript.php
 * Type: string, html
 * Name: oxscript
 * Purpose: Collect given javascript includes/calls, but include/call them at the bottom of the page.
 *
 * Add [{oxscript add="oxid.popup.load();"}] to add script call.
 * Add [{oxscript include="oxid.js"}] to include local javascript file.
 * Add [{oxscript include="oxid.js?20120413"}] to include local javascript file with query string part.
 * Add [{oxscript include="http://www.oxid-esales.com/oxid.js"}] to include external javascript file.
 *
 * IMPORTANT!
 * Do not forget to add plain [{oxscript}] tag before closing body tag, to output all collected script includes and calls.
 * -------------------------------------------------------------
 *
 * @param array  $params Params
 * @param Smarty $smarty Clever simulation of a method
 *
 * @return string
 */
function smarty_function_oxscript($params, &$smarty)
{
    $isDynamic = isset($smarty->_tpl_vars["__oxid_include_dynamic"]) ? (bool) $smarty->_tpl_vars["__oxid_include_dynamic"] : false;
    $priority = !empty($params['priority']) ? $params['priority'] : 3;
    $widget = !empty($params['widget']) ? $params['widget'] : '';
    $isInWidget = !empty($params['inWidget']) ? $params['inWidget'] : false;
    $output = '';
    if (isset($params['add'])) {
        if (empty($params['add'])) {
            $smarty->trigger_error("{oxscript} parameter 'add' can not be empty!");
            return '';
        }
        $register = oxNew('OxidEsales\\EshopCommunity\\Core\\ViewHelper\\JavaScriptRegistrator');
        $register->addSnippet($params['add'], $isDynamic);
    } elseif (isset($params['include'])) {
        if (empty($params['include'])) {
            $smarty->trigger_error("{oxscript} parameter 'include' can not be empty!");
            return '';
        }
        $register = oxNew('OxidEsales\\EshopCommunity\\Core\\ViewHelper\\JavaScriptRegistrator');
        $register->addFile($params['include'], $priority, $isDynamic);
    } else {
        $renderer = oxNew('OxidEsales\\EshopCommunity\\Core\\ViewHelper\\JavaScriptRenderer');
        $output = $renderer->render($widget, $isInWidget, $isDynamic);
    }
    return $output;
}
开发者ID:Alpha-Sys,项目名称:oxideshop_ce,代码行数:49,代码来源:function.oxscript.php


示例14: smarty_function_public_url

/**
 * @param array $params
 * SSL default behaviour:
 * Decided by current page.
 * Set parameter __ssl to true or false to override default ssl behaviour.
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_public_url($params = array(), &$smarty)
{
    $path = '';
    if (!empty($params['path'])) {
        $path = $params['path'];
        unset($params['path']);
    }
    if (!empty($params['__ssl'])) {
        $ssl = $params['__ssl'];
        unset($params['__ssl']);
    } else {
        $ssl = \Skully\App\Helpers\UrlHelper::isSecure();
    }
    $arguments = array();
    foreach ($params as $key => $val) {
        $arguments[$key] = $val;
    }
    /** @var \Skully\ApplicationInterface $app */
    $app = $smarty->getRegisteredObject('app');
    if (strpos($path, "http://") !== 0 && strpos($path, "https://") !== 0) {
        $path = $app->getTheme()->getPublicBaseUrl($ssl) . $path;
    }
    if (!empty($arguments)) {
        $argumentsStr = http_build_query($arguments);
        return $path . '?' . $argumentsStr;
    } else {
        return $path;
    }
}
开发者ID:skullyframework,项目名称:skully,代码行数:37,代码来源:function.public_url.php


示例15: smarty_function_optiondisplayer

/**
 * Smarty {optiondisplayer} function plugin
 *
 * Type:     function<br>
 * Name:     optiondisplayer<br>
 * Purpose:  display option dropdown list
 *
 * @param         $params
 * @param \Smarty $smarty
 * @return bool
 */
function smarty_function_optiondisplayer($params, &$smarty)
{
    global $db;
    $groupname = $params['options'];
    $product = $params['product'];
    $display_price_as = isset($params['display_price_as']) ? $params['display_price_as'] : 'diff';
    // get the option group
    $og = new optiongroup();
    //$group = $og->find('bytitle', $groupname);
    $group = $og->find('first', 'product_id=' . $product->id . ' AND title="' . $groupname . '"');
    //grab the options configured for this product
    $options = $product->optionDropdown($group->title, $display_price_as);
    // if there are no  options we can return now
    if (empty($options)) {
        return false;
    }
    // find the default option if there is one.
    $default = $db->selectValue('option', 'id', 'optiongroup_id=' . $group->id . ' AND is_default=1');
    $view = $params['view'];
    //if((isset() || $og->required == false) $includeblank = $params['includeblank'] ;
    //elseif((isset($params['includeblank']) && $params['includeblank'] == false) || $og->required == true) $includeblank = false;
    $includeblank = $og->required == false && !isset($params['includeblank']) ? gt('-- Please Select an Option --') : $params['includeblank'];
    $template = get_common_template($view, $smarty->getTemplateVars('__loc'), 'options');
    $template->assign('product', $product);
    $template->assign('options', $options);
    $template->assign('group', $group);
    $template->assign('params', $params);
    $template->assign('default', $default);
    $template->assign('includeblank', $includeblank);
    $template->assign('required', $params['required']);
    $template->assign('selected', $params['selected']);
    echo $template->render();
}
开发者ID:notzen,项目名称:exponent-cms,代码行数:44,代码来源:function.optiondisplayer.php


示例16: render

 /**
  * executes & displays the template results
  *
  * 是否压缩传输默认是开启的,最终还是取决于浏览器和服务器
  *
  * @param $template string
  *            模板文件名
  * @param $return bool
  *            是否返回到php变量
  */
 public function render($tplvar = array(), $template = null)
 {
     header('content-type:text/html;charset=utf-8');
     if ($template == null) {
         $template = FL_PAGE_MOD . '/' . FL_PAGE_ACT;
     }
     $template .= '.html';
     $smarty = new \Smarty();
     $smarty->allow_php_templates = true;
     $smarty->left_delimiter = '{';
     $smarty->right_delimiter = '}';
     // $this->addPluginsDir ( __FASTLIB__ . FastLoad::getplatform ( true ) .
     // '/smarty_plug' ); // 加入PLUG目录
     $smarty->setTemplateDir(FL_PAGE_DIR . '/templates');
     $smarty->setCompileDir(FL_TMP . '/templates_c/' . FL_PAGE_DIR . '/compile');
     $smarty->assign($tplvar);
     // $this->registerFilter ( 'pre', create_function ( '$tplString',
     // 'return strtr($tplString,array(\'<!--{\'=>\'{\',\'}-->\'=>\'}\'));' )
     // );
     // $this->registerFilter ( 'pre', create_function ( '$tplString',
     // 'return
     // preg_replace_callback("/\{{$delimiter}[^\{$delimiter}]+{$delimiter}\}/",
     // array(fasttpl,gettextCompiler), $tplString);' ) );
     if (FL_DEBUG) {
         $smarty->compile_check = true;
         $smarty->caching = false;
     } else {
         $smarty->compile_check = false;
         $smarty->caching = false;
         $smarty->merge_compiled_includes = true;
     }
     $smarty->display($template);
 }
开发者ID:glzaboy,项目名称:fastlib,代码行数:43,代码来源:page.php


示例17: send

function send($id)
{
    $form = is_array($id) ? $id : get($id);
    $results = results($id);
    if (!$results) {
        return false;
    }
    if (!is_array($form['template']) || !strlen($form['template']['recipient'])) {
        return false;
    }
    $smarty = new \Smarty();
    $smarty->compile_check = true;
    $smarty->debugging = false;
    foreach ($results as $nm => $val) {
        $smarty->assign($nm, $val);
    }
    $mail = new \PHPMailer();
    $mail->CharSet = 'UTF-8';
    $mail->Subject = $smarty->fetch('string:' . $form['template']['subject']);
    $addresses = explode(',', $form['template']['recipient']);
    foreach ($addresses as $a) {
        $mail->AddAddress(trim($a));
    }
    $mail->MsgHTML($smarty->fetch('string:' . $form['template']['body']));
    return $mail->Send();
}
开发者ID:sd-studio,项目名称:sh,代码行数:26,代码来源:form.php


示例18: smarty_function_object_subscriptions

/**
 * Render object subscribers
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_object_subscriptions($params, &$smarty)
{
    $object = array_var($params, 'object');
    if (!instance_of($object, 'ProjectObject')) {
        return new InvalidParamError('object', $object, '$object is expected to be an instance of ProjectObject class', true);
    }
    // if
    js_assign('max_subscribers_count', MAX_SUBSCRIBERS_COUNT);
    require_once SYSTEM_MODULE_PATH . '/helpers/function.user_link.php';
    $subscribers = $object->getSubscribers();
    if (count($subscribers) > MAX_SUBSCRIBERS_COUNT) {
        $smarty->assign(array('_object_subscriptions_list_subscribers' => false, '_object_subscriptions_object' => $object, '_object_subscriptions_subscribers_count' => count($subscribers), '_object_subscription_brief' => array_var($params, 'brief', false), '_object_subscriptions_popup_url' => assemble_url('object_subscribers_widget', array('object_id' => $object->getId()))));
    } else {
        $links = null;
        if (is_foreachable($subscribers)) {
            $links = array();
            foreach ($subscribers as $subscriber) {
                $links[] = smarty_function_user_link(array('user' => $subscriber), $smarty);
            }
            // foreach
        }
        // if
        $smarty->assign(array('_object_subscriptions_list_subscribers' => true, '_object_subscriptions' => $subscribers, '_object_subscriptions_object' => $object, '_object_subscription_links' => $links, '_object_subscription_brief' => array_var($params, 'brief', false), '_object_subscriptions_popup_url' => assemble_url('object_subscribers_widget', array('object_id' => $object->getId()))));
    }
    // if
    return $smarty->fetch(get_template_path('_object_subscriptions', 'subscriptions', RESOURCES_MODULE));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:34,代码来源:function.object_subscriptions.php


示例19: smarty_function_add_form_element

/**
 * Render and add a form element to both the PHP session and HTML output.
 *
 * @experimental
 * @param array  $params  Associative (and/or indexed) array of smarty parameters passed in from the template
 * @param Smarty $smarty  Parent Smarty template object
 *
 * @return string
 * @throws SmartyException
 */
function smarty_function_add_form_element($params, $smarty){

	if(!isset($params['form'])){
		$form = null;
	}
	elseif($params['form'] instanceof Form){
		$form = $params['form'];
	}
	elseif($params['form'] instanceof \Core\ListingTable\Table){
		$form = $params['form']->getEditForm();
	}
	else{
		throw new SmartyException('Unsupported value provided for "form", please ensure it is either a valid Form object or omitted completely!');
	}

	$type = isset($params['type']) ? $params['type'] : 'text';

	$element = FormElement::Factory($type, $params);

	if($form){
		$form->addElement($element);
	}

	// Assign or render?
	if(isset($params['assign'])){
		$smarty->assign($params['assign'], $element->render());
	}
	else{
		echo $element->render();
	}
}
开发者ID:nicholasryan,项目名称:CorePlus,代码行数:41,代码来源:function.add_form_element.php


示例20: GenOutput

 public function GenOutput()
 {
     $this->tables = array();
     foreach ($this->codeGenerator->getClasses() as $class) {
         $columns = array();
         if ($class->hasChild()) {
             foreach ($class->getChildElements() as $element) {
                 if ($element->getType() == Type::PropertyElement) {
                     $columnText = $element->getAttribute(self::Column);
                     if ($columnText != null) {
                         $column = $this->getColumnParams(substr($columnText, 1, -1));
                         $column['name'] = $element->getName();
                         $columns[] = $column;
                     }
                 }
             }
             if (count($columns) > 0) {
                 $this->tables[$class->getName()] = array("name" => $class->getName(), "columns" => $columns);
             }
         }
     }
     $smarty = new \Smarty();
     // $smarty->caching = false;
     $smarty->assign("tables", $this->tables);
     $smarty->display(__DIR__ . '/database.tpl');
 }
开发者ID:samuferenc,项目名称:codegenerator,代码行数:26,代码来源:Driver.php



注:本文中的Smarty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SmartyPaginate类代码示例发布时间:2022-05-23
下一篇:
PHP Slug类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap