当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty::template_exists方法代码示例

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


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

示例1: render

 public function render($view)
 {
     if ($this->tpl->template_exists($view)) {
         return $this->tpl->fetch($view);
     } else {
         throw new ViewNotFoundException($view);
     }
 }
开发者ID:saiber,项目名称:www,代码行数:8,代码来源:SmartyRenderer.php

示例2: smarty_insert_block

/**
 * Плагин для смарти
 * Подключает обработчик блоков шаблона
 *
 * @param array $aParams
 * @param Smarty $oSmarty
 * @return string
 */
function smarty_insert_block($aParams, &$oSmarty)
{
    /**
     * Устанавливаем шаблон
     */
    $sBlock = ucfirst(basename($aParams['block']));
    /**
     * Проверяем наличие шаблона. Определяем значения параметров работы в зависимости от того, 
     * принадлежит ли блок одному из плагинов, или является пользовательским классом движка
     */
    if (isset($aParams['params']) and isset($aParams['params']['plugin'])) {
        require_once Config::Get('path.root.server') . '/engine/classes/ActionPlugin.class.php';
        $sBlockTemplate = Plugin::GetTemplatePath($aParams['params']['plugin']) . '/block.' . $aParams['block'] . '.tpl';
        $sBlockClass = Config::Get('path.root.server') . '/plugins/' . $aParams['params']['plugin'] . '/classes/blocks/Block' . $sBlock . '.class.php';
        $sCmd = '$oBlock=new Plugin' . ucfirst($aParams['params']['plugin']) . '_Block' . $sBlock . '($aParamsBlock);';
    } else {
        $sBlockTemplate = Engine::getInstance()->Plugin_GetDelegate('template', 'block.' . $aParams['block'] . '.tpl');
        $sBlockClass = Config::Get('path.root.server') . '/classes/blocks/Block' . $sBlock . '.class.php';
        $sCmd = '$oBlock=new Block' . $sBlock . '($aParamsBlock);';
    }
    if (!isset($aParams['block']) or !$oSmarty->template_exists($sBlockTemplate)) {
        $oSmarty->trigger_error("Not found template for block: " . $sBlockTemplate);
        return;
    }
    /**
     * параметры
     */
    $aParamsBlock = array();
    if (isset($aParams['params'])) {
        $aParamsBlock = $aParams['params'];
    }
    /**
     * Подключаем необходимый обработчик
     */
    require_once $sBlockClass;
    eval($sCmd);
    /**
     * Запускаем обработчик
     */
    $oBlock->Exec();
    /**
     * Возвращаем результат в виде обработанного шаблона блока
     */
    return $oSmarty->fetch($sBlockTemplate);
}
开发者ID:lifecom,项目名称:test,代码行数:53,代码来源:insert.block.php

示例3: TemplateExists

 /**
  * Проверяет существование шаблона
  *
  * @param string $sTemplate
  * @return bool
  */
 public function TemplateExists($sTemplate)
 {
     return $this->oSmarty->template_exists($sTemplate);
 }
开发者ID:lifecom,项目名称:test,代码行数:10,代码来源:Viewer.class.php

示例4: Smarty

}
$email_message->SetEncodedHeader("Subject", $subject);
/*
 *  If you are not going to personalize the message body for each recipient,
 *  set the cache_body flag to 1 to reduce the time that the class will take
 *  to regenerate the message to send to each recipient
 */
$email_message->cache_body = 0;
/*
 *  Lets use two distinct Smarty objects for composing the HTML and text
 *  parts and avoid the need to re-assign constant values when switching
 *  contexts.
 */
$html_smarty = new Smarty();
$text_smarty = new Smarty();
if (!$html_smarty->template_exists($template = "mailing.html.tpl") || !$text_smarty->template_exists($template = "mailing.txt.tpl")) {
    echo "Please copy the template file templates/" . $template . " to your Smarty templates directory.\n";
    exit;
}
/*  Create empty parts for the parts that will be personalized for each recipient.
 *  HTML message values should be escaped with HTMLEntities().
 */
$html_smarty->assign("subject", HtmlEntities($subject));
$html_smarty->assign("fromname", HtmlEntities($from_name));
$html_smarty->assign("firstname", "");
$html_smarty->assign("balance", "0");
$html_smarty->assign("email", "?");
$html_message = $html_smarty->fetch("mailing.html.tpl");
$email_message->CreateQuotedPrintableHTMLPart($html_message, "", $html_part);
/*
 *  It is strongly recommended that when you send HTML messages,
开发者ID:anubhaBhargava,项目名称:OpenRecommender,代码行数:31,代码来源:test_smarty_personalized_mailing.php

示例5: Smarty

    /*
     * The form is ready to be processed, just output it again as read only to
     * display the submitted values.  A real form processing script usually may
     * do something else like storing the form values in a database.
     */
    $form->ReadOnly = 1;
}
/*
 * Create the Smarty engine object to process the form template first
 *
 * NOTE: the form template needs to be processed separately from any other
 * page templates to prevent that the form prefilter interferes with the
 * normal processing of the other templates
 */
$smarty = new Smarty();
if ($smarty->template_exists("form.tpl")) {
    $smarty->assign_by_ref("form", $form);
    $smarty->assign("title", "Form class test");
    $smarty->assign("error_message", $error_message);
    $smarty->assign_by_ref("verify", $verify);
    $smarty->assign("doit", $doit);
    $smarty->assign("mark", "[Verify]");
    $smarty->assign("credit_card_field", "credit_card_number");
    $smarty->register_prefilter("smarty_prefilter_form");
    $smarty->fetch("form.tpl");
    $smarty->unregister_prefilter("smarty_prefilter_form");
} else {
    $form->AddDataPart("<h2><center>Please copy the template file <tt>templates/form.tpl</tt> to your Smarty <tt>templates</tt> directory.</center></h2>\n");
    $doit = 1;
}
/*
开发者ID:wycus,项目名称:darmedic,代码行数:31,代码来源:test_smarty_form.php

示例6: template_exists

 public function template_exists($resource_name)
 {
     if (method_exists($this, "templateExists")) {
         return $this->templateExists($resource_name);
     } else {
         return parent::template_exists($resource_name);
     }
 }
开发者ID:jbaicoianu,项目名称:elation,代码行数:8,代码来源:templatemanager_class.php


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