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


PHP eZTemplate类代码示例

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


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

示例1: getValidItems

 /**
  * Returns block item XHTML
  *
  * @param mixed $args
  * @return array
  */
 public static function getValidItems($args)
 {
     $http = eZHTTPTool::instance();
     $tpl = eZTemplate::factory();
     $result = array();
     $blockID = $http->postVariable('block_id');
     $offset = $http->postVariable('offset');
     $limit = $http->postVariable('limit');
     $validNodes = eZFlowPool::validNodes($blockID);
     $counter = 0;
     foreach ($validNodes as $validNode) {
         if (!$validNode->attribute('can_read')) {
             continue;
         }
         $counter++;
         if ($counter <= $offset) {
             continue;
         }
         $tpl->setVariable('node', $validNode);
         $tpl->setVariable('view', 'block_item');
         $tpl->setVariable('image_class', 'blockgallery1');
         $content = $tpl->fetch('design:node/view/view.tpl');
         $result[] = $content;
         if ($counter === $limit) {
             break;
         }
     }
     return $result;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:35,代码来源:ezflowservercallfunctions.php

示例2: sendOrderEmail

 function sendOrderEmail($params)
 {
     $ini = eZINI::instance();
     if (isset($params['order']) and isset($params['email'])) {
         $order = $params['order'];
         $email = $params['email'];
         $tpl = eZTemplate::factory();
         $tpl->setVariable('order', $order);
         $templateResult = $tpl->fetch('design:shop/orderemail.tpl');
         $subject = $tpl->variable('subject');
         $mail = new eZMail();
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
         if (!$emailSender) {
             $emailSender = $ini->variable("MailSettings", "AdminEmail");
         }
         if ($tpl->hasVariable('content_type')) {
             $mail->setContentType($tpl->variable('content_type'));
         }
         $mail->setReceiver($email);
         $mail->setSender($emailSender);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         $mailResult = eZMailTransport::send($mail);
         $email = $ini->variable('MailSettings', 'AdminEmail');
         $mail = new eZMail();
         if ($tpl->hasVariable('content_type')) {
             $mail->setContentType($tpl->variable('content_type'));
         }
         $mail->setReceiver($email);
         $mail->setSender($emailSender);
         $mail->setSubject($subject);
         $mail->setBody($templateResult);
         $mailResult = eZMailTransport::send($mail);
     }
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:35,代码来源:ezdefaultconfirmorderhandler.php

示例3: run

 protected static function run()
 {
     self::checkIfLoggedIn();
     $ini = eZINI::instance('cookielaw.ini');
     if (self::$isActive) {
         $message = ezpI18n::tr('extension/occookielaw', "I cookie ci aiutano ad erogare servizi di qualità. Utilizzando i nostri servizi, l'utente accetta le nostre modalità d'uso dei cookie.");
         if ($ini->hasVariable('AlertSettings', 'MessageText')) {
             $message = $ini->variable('AlertSettings', 'MessageText');
         }
         $dismiss = ezpI18n::tr('extension/occookielaw', "OK");
         if ($ini->hasVariable('AlertSettings', 'DismissButtonText')) {
             $dismiss = $ini->variable('AlertSettings', 'DismissButtonText');
         }
         $info = ezpI18n::tr('extension/occookielaw', "Maggiori informazioni");
         if ($ini->hasVariable('AlertSettings', 'InfoButtonText')) {
             $info = $ini->variable('AlertSettings', 'InfoButtonText');
         }
         $tpl = eZTemplate::factory();
         $tpl->setVariable('message', $message);
         $tpl->setVariable('dismiss_button', $dismiss);
         $tpl->setVariable('info_button', $info);
         return $tpl->fetch('design:inject_in_page_layout.tpl');
     }
     return '';
 }
开发者ID:OpencontentCoop,项目名称:occookielaw,代码行数:25,代码来源:occookielaw.php

示例4: render

    /**
     * Renders the block (returns HTML)
     *
     * @return string HTML
     **/
    public function render()
    {
        $tpl = eZTemplate::factory();
        $tpl->setVariable( 'localized_apps', $this->fetchApplications() );

        return $tpl->fetch( 'design:presenters/block/carousel.tpl' );
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:12,代码来源:mmblockcarouselpresenter.php

示例5: getNextItems

 /**
  * Returns block item XHTML
  *
  * @param mixed $args
  * @return array
  */
 public static function getNextItems($args)
 {
     $http = eZHTTPTool::instance();
     $tpl = eZTemplate::factory();
     $result = array();
     $galleryID = $http->postVariable('gallery_id');
     $offset = $http->postVariable('offset');
     $limit = $http->postVariable('limit');
     $galleryNode = eZContentObjectTreeNode::fetch($galleryID);
     if ($galleryNode instanceof eZContentObjectTreeNode) {
         $params = array('Depth' => 1, 'Offset' => $offset, 'Limit' => $limit);
         $pictureNodes = $galleryNode->subtree($params);
         foreach ($pictureNodes as $validNode) {
             $tpl->setVariable('node', $validNode);
             $tpl->setVariable('view', 'block_item');
             $tpl->setVariable('image_class', 'blockgallery1');
             $content = $tpl->fetch('design:node/view/view.tpl');
             $result[] = $content;
             if ($counter === $limit) {
                 break;
             }
         }
     }
     return $result;
 }
开发者ID:nfrp,项目名称:eZ-Publish-Training-examples,代码行数:31,代码来源:trainingservercallfunctions.php

示例6: getGooglePlusComments

 /**
  * Generate G+ comments feed for an activity
  * @param eZTemplate $tpl
  * @param array $namedParameters
  * @return string
  */
 private function getGooglePlusComments($tpl, $namedParameters)
 {
     //get config
     $nlGooglePlusIni = eZINI::instance('nlgoogleplus.ini');
     //initilize G+ Service
     $plus = $this->initializeGooglePlusService();
     if (!isset($namedParameters['activityid'])) {
         eZLog::write('Activity id is required', 'error.log');
         return false;
     }
     //parameters needed
     $activityId = $namedParameters['activityid'];
     $title = $namedParameters['title'];
     //find all related comments
     $optParams = array('maxResults' => $nlGooglePlusIni->variable('Feed', 'MaxResults'));
     try {
         $comments = $plus->comments->listComments($activityId, $optParams);
     } catch (Exception $e) {
         eZLog::write('Google Plus get comments problem : ' . $e->getMessage(), 'error.log');
     }
     //use template
     $tpl->setVariable('comments', $comments);
     $tpl->setVariable('title', $title);
     return $tpl->fetch('design:nlgoogleplus/googleplusboxcomments.tpl');
 }
开发者ID:nlescure,项目名称:nl-google-plus-for-ez-publish,代码行数:31,代码来源:nl_googleplus.php

示例7: prime

 function prime( &$tr )
 {
     $tpl = eZTemplate::factory();
     $tpl->setIsCachingAllowed( true );
     eZTemplateCompiler::setSettings( array( 'compile' => true,
                                             'comments' => false,
                                             'accumulators' => false,
                                             'timingpoints' => false,
                                             'fallbackresource' => false,
                                             'nodeplacement' => false,
                                             'execution' => true,
                                             'generate' => true,
                                             'compilation-directory' => 'benchmarks/eztemplate/compilation' ) );
     $expected = $tpl->fetch( 'benchmarks/eztemplate/mark.tpl' );
     eZTemplateCompiler::setSettings( array( 'compile' => true,
                                             'comments' => false,
                                             'accumulators' => false,
                                             'timingpoints' => false,
                                             'fallbackresource' => false,
                                             'nodeplacement' => false,
                                             'execution' => true,
                                             'generate' => false,
                                             'compilation-directory' => 'benchmarks/eztemplate/compilation' ) );
     $tpl->reset();
     $this->TPL = $tpl;
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:26,代码来源:ezmarktemplatecompiler.php

示例8: runModify

    private function runModify( $operatorName, $method )
    {
        $operator = new eZURLOperator();
        $tpl = eZTemplate::instance();

        $operatorValue = null;

        $argument = 'zeargument';
        $expectedResult = 'zevalue';

        switch( $method )
        {
            case 'get'    : $_GET[$argument]     = $expectedResult; break;
            case 'post'   : $_POST[$argument]    = $expectedResult; break;
            case 'cookie' : $_COOKIE[$argument]  = $expectedResult; break;
            case 'session': $_SESSION[$argument] = $expectedResult; break;
        }

        $operatorParameters = array(
            array( array( 1, $argument, false, ), ),
            array( array( 1, $method, false, ), ),
        );

        $namedParameters = array(
            'quote_val'  => $argument,
            'server_url' => $method
        );

        $operator->modify(
            $tpl, $operatorName, $operatorParameters, '', '', $operatorValue, $namedParameters, false
        );

        $this->assertEquals( $expectedResult, $operatorValue );
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:34,代码来源:ezurloperator_test.php

示例9: render

 /**
  * Renders the block (returns HTML)
  *
  * @return string HTML
  **/
 public function render()
 {
     $tpl = eZTemplate::factory();
     $tpl->setVariable( 'name', $this->name );
     $tpl->setVariable( 'banners', $this->fetchBanners() );
     $tpl->setVariable( 'cluster_identifier', ClusterTool::clusterIdentifier() );
     return $tpl->fetch( 'design:presenters/block/channel.tpl' );
 }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:13,代码来源:mmblockchannelpresenter.php

示例10: render

    /**
     * Renders the block (returns HTML)
     *
     * @return string HTML
     **/
    public function render()
    {
        $tpl = eZTemplate::factory();
        $tpl->setVariable( 'articles', $this->getSolrArticles() );
        $blockResult = $tpl->fetch( 'design:presenters/block/congressreport.tpl' );
        eZTemplate::resetInstance();

        return $blockResult;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:14,代码来源:mmblockcongressreportpresenter.php

示例11: displayForm

function displayForm($Result, $errors = null)
{
    $tpl = eZTemplate::factory();
    $tpl->setVariable('errors', $errors);
    $Result['path'] = array(array('url' => '/', 'text' => ezpI18n::tr('mailchimp/subscribe', 'Home')), array('url' => false, 'text' => ezpI18n::tr('mailchimp/subscribe', 'Subscribe')));
    $Result['title'] = 'Subscribe';
    $Result['content'] = $tpl->fetch("design:mailchimp/subscribe.tpl");
    return $Result;
}
开发者ID:eab-dev,项目名称:eabmcsubscribe,代码行数:9,代码来源:subscribe.php

示例12: render

    /**
     * Renders the block (returns HTML)
     *
     * @return string HTML
     **/
    public function render()
    {
        $tpl = eZTemplate::factory();
        $page = $this->fetchStaticPage();
        $tpl->setVariable( 'core_content', str_replace( '/bundles/static-data/', '/esibuild/static/', $page->attribute('core_content') ) );
        $renderResult = $tpl->fetch( 'design:presenters/block/content.tpl' );
        eZTemplate::resetInstance();

        return $renderResult;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:15,代码来源:mmblockcontentpresenter.php

示例13: render

 /**
  * Returns string with rendered content
  *
  * @return string
  */
 public function render()
 {
     $tpl = eZTemplate::factory();
     $ini = eZINI::instance('rest.ini');
     $nodeViewData = eZNodeviewfunctions::generateNodeViewData($tpl, $this->content->main_node, $this->content->main_node->attribute('object'), $this->content->activeLanguage, 'rest', 0);
     $tpl->setVariable('module_result', $nodeViewData);
     $routingInfos = $this->controller->getRouter()->getRoutingInformation();
     $templateName = $ini->variable($routingInfos->controllerClass . '_' . $routingInfos->action . '_OutputSettings', 'Template');
     return $tpl->fetch('design:' . $templateName);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:15,代码来源:xhtml_content_renderer.php

示例14: modify

 /**
  * Executes the template operator
  *
  * @param eZTemplate $tpl
  * @param string $operatorName
  * @param mixed $operatorParameters
  * @param string $rootNamespace
  * @param string $currentNamespace
  * @param mixed $operatorValue
  * @param array $namedParameters
  * @param mixed $placement
  */
 function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)
 {
     if (!is_string($namedParameters['name']) && empty($namedParameters['name'])) {
         $tpl->error($operatorName, "{$operatorName} parameter 'name' must be a non empty string.", $placement);
         return;
     }
     $templateName = $namedParameters['name'];
     if ($namedParameters['parameters'] !== null && !is_array($namedParameters['parameters'])) {
         $tpl->error($operatorName, "{$operatorName} parameter 'parameters' must be a hash array.", $placement);
         return;
     }
     $templateParameters = $namedParameters['parameters'] !== null ? $namedParameters['parameters'] : array();
     $apiContentConverter = NgSymfonyToolsApiContentConverter::instance();
     foreach ($templateParameters as $parameterName => $parameterValue) {
         $templateParameters[$parameterName] = $apiContentConverter->convert($parameterValue);
     }
     $serviceContainer = ezpKernel::instance()->getServiceContainer();
     $templatingEngine = $serviceContainer->get('templating');
     $operatorValue = $templatingEngine->render($templateName, $templateParameters);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:32,代码来源:ngsymfonytoolsincludeoperator.php

示例15: templateInit

 /**
  * Abstract method to initialize a template and eventually takes advantage of new 4.3 TPL API
  * @return eZTemplate
  */
 public static function templateInit()
 {
     $tpl = null;
     if (eZPublishSDK::majorVersion() >= 4 && eZPublishSDK::minorVersion() < 3) {
         include_once 'kernel/common/template.php';
         $tpl = templateInit();
     } else {
         $tpl = eZTemplate::factory();
     }
     return $tpl;
 }
开发者ID:lolautruche,项目名称:sqliimport,代码行数:15,代码来源:sqliimportutils.php


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