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


PHP Zend_Layout::render方法代码示例

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


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

示例1: create

 /**
  * Implementation \Extlib\Mail\Message\MessageInterface::create()
  * 
  * @param string $template
  * @return string|html 
  */
 public function create($template = null)
 {
     if (null !== $template) {
         $this->setScriptName($template);
     }
     $this->layout->assign('content', $this->layout->getView()->render($this->getScript()));
     return $this->layout->render();
 }
开发者ID:lciolecki,项目名称:zf-extensions-library,代码行数:14,代码来源:Html.php

示例2: fromTemplate

 /**
  * Set the e-mail's body from a template
  * 
  * @param  string $tempalte
  * @param  array  $params
  * @return Geves_Mail
  */
 public function fromTemplate($template, array $params)
 {
     $view = new Zend_View();
     $view->setScriptPath($this->_templateDir);
     $view->assign($params);
     if ($this->_layout) {
         $this->_layout->content = $view->render($template . '.phtml');
         $html = $this->_layout->render();
     } else {
         $html = $view->render($template . '.phtml');
     }
     $this->setBodyHtml($html);
     $this->setBodyText(strip_tags($html));
     return $this;
 }
开发者ID:shevron,项目名称:stoa,代码行数:22,代码来源:Mail.php

示例3: shutdown

 /**
  * Sends mail to recipient(s) if log entries are present.  Note that both
  * plaintext and HTML portions of email are handled here.
  *
  * @return void
  */
 public function shutdown()
 {
     // If there are events to mail, use them as message body.  Otherwise,
     // there is no mail to be sent.
     if (empty($this->_eventsToMail)) {
         return;
     }
     if ($this->_subjectPrependText !== null) {
         // Tack on the summary of entries per-priority to the subject
         // line and set it on the Zend_Mail object.
         $numEntries = $this->_getFormattedNumEntriesPerPriority();
         $this->_mail->setSubject("{$this->_subjectPrependText} ({$numEntries})");
     }
     // Always provide events to mail as plaintext.
     $this->_mail->setBodyText(implode('', $this->_eventsToMail));
     // If a Zend_Layout instance is being used, set its "events"
     // value to the lines formatted for use with the layout.
     if ($this->_layout) {
         // Set the required "messages" value for the layout.  Here we
         // are assuming that the layout is for use with HTML.
         $this->_layout->events = implode('', $this->_layoutEventsToMail);
         $this->_mail->setBodyHtml($this->_layout->render());
     }
     // Finally, send the mail, but re-throw any exceptions at the
     // proper level of abstraction.
     try {
         $this->_mail->send();
     } catch (Exception $e) {
         throw new Zend_Log_Exception($e->getMessage(), $e->getCode());
     }
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:37,代码来源:Mail.php

示例4: sendEmail

 public function sendEmail($template, $to, $subject, $params = array())
 {
     try {
         $config = array('auth' => 'Login', 'port' => $this->_bootstrap_options['mail']['port'], 'ssl' => 'ssl', 'username' => $this->_bootstrap_options['mail']['username'], 'password' => $this->_bootstrap_options['mail']['password']);
         $tr = new Zend_Mail_Transport_Smtp($this->_bootstrap_options['mail']['server'], $config);
         Zend_Mail::setDefaultTransport($tr);
         $mail = new Zend_Mail('UTF-8');
         $layout = new Zend_Layout();
         $layout->setLayoutPath($this->_bootstrap_options['mail']['layout']);
         $layout->setLayout('email');
         $view = $layout->getView();
         $view->domain_url = $this->_bootstrap_options['site']['domainurl'];
         $view = new Zend_View();
         $view->params = $params;
         $view->setScriptPath($this->_bootstrap_options['mail']['view_script']);
         $layout->content = $view->render($template . '.phtml');
         $content = $layout->render();
         $mail->setBodyText(preg_replace('/<[^>]+>/', '', $content));
         $mail->setBodyHtml($content);
         $mail->setFrom($this->_bootstrap_options['mail']['from'], $this->_bootstrap_options['mail']['from_name']);
         $mail->addTo($to);
         $mail->setSubject($subject);
         $mail->send();
     } catch (Exception $e) {
         // 这里要完善
     }
     return true;
 }
开发者ID:ud223,项目名称:yj,代码行数:28,代码来源:Email.php

示例5: shutdown

    /**
     * Sends mail to recipient(s) if log entries are present.  Note that both
     * plaintext and HTML portions of email are handled here.
     *
     * @return void
     */
    public function shutdown()
    {
        // If there are events to mail, use them as message body.  Otherwise,
        // there is no mail to be sent.
        if (empty($this->_eventsToMail)) {
            return;
        }

        if ($this->_subjectPrependText !== null) {
            // Tack on the summary of entries per-priority to the subject
            // line and set it on the Zend_Mail object.
            $numEntries = $this->_getFormattedNumEntriesPerPriority();
            $this->_mail->setSubject(
                "{$this->_subjectPrependText} ({$numEntries})");
        }


        // Always provide events to mail as plaintext.
        $this->_mail->setBodyText(implode('', $this->_eventsToMail));

        // If a Zend_Layout instance is being used, set its "events"
        // value to the lines formatted for use with the layout.
        if ($this->_layout) {
            // Set the required "messages" value for the layout.  Here we
            // are assuming that the layout is for use with HTML.
            $this->_layout->events =
                implode('', $this->_layoutEventsToMail);

            // If an exception occurs during rendering, convert it to a notice
            // so we can avoid an exception thrown without a stack frame.
            try {
                $this->_mail->setBodyHtml($this->_layout->render());
            } catch (Exception $e) {
                trigger_error(
                    "exception occurred when rendering layout; " .
                        "unable to set html body for message; " .
                        "message = {$e->getMessage()}; " .
                        "code = {$e->getCode()}; " .
                        "exception class = " . get_class($e),
                    E_USER_NOTICE);
            }
        }

        // Finally, send the mail.  If an exception occurs, convert it into a
        // warning-level message so we can avoid an exception thrown without a
        // stack frame.
        try {
            $this->_mail->send();
        } catch (Exception $e) {
            trigger_error(
                "unable to send log entries via email; " .
                    "message = {$e->getMessage()}; " .
                    "code = {$e->getCode()}; " .
                        "exception class = " . get_class($e),
                E_USER_WARNING);
        }
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:63,代码来源:Mail.php

示例6: setViewBody

 public function setViewBody($script, $params = array())
 {
     $layout = new Zend_Layout(array('layoutPath' => $this->_getLayoutPath()));
     $layout->setLayout('email');
     $view = new Zend_View();
     $view->setScriptPath($this->_getViewPath() . '/email');
     foreach ($params as $k => $param) {
         $view->assign($k, $param);
     }
     $layout->content = $view->render($script . '.phtml');
     //$layout->content = $msg;
     $html = $layout->render();
     $this->setBodyHtml($html);
 }
开发者ID:hYOUstone,项目名称:tsg,代码行数:14,代码来源:Model.php

示例7: setBodyView

 public function setBodyView($script, $params = array())
 {
     $layout = new Zend_Layout(array('layoutPath' => APPLICATION_PATH . '/views/layouts'));
     $layout->setLayout('email');
     $view = new Zend_View();
     $view->setScriptPath(APPLICATION_PATH . '/views/email');
     foreach ($params as $key => $value) {
         $view->assign($key, $value);
     }
     $layout->content = $view->render($script . '.phtml');
     $html = $layout->render();
     $this->setBodyHtml($html);
     return $this;
 }
开发者ID:Remchi,项目名称:ZF-Quani,代码行数:14,代码来源:Mail.php

示例8: __invoke

 public function __invoke($message)
 {
     $layout = new Zend_Layout();
     // Установка пути к скриптам макета:
     $layout->setLayoutPath(APPLICATION_PATH . '/views/scripts/layouts');
     $layout->setLayout('inner');
     $view = new Zend_View();
     $view->setBasePath(APPLICATION_PATH . '/views/');
     $view->error_message = $message;
     // установка переменных:
     $layout->content = $view->render('/exeption/user.phtml');
     echo $layout->render();
     //echo $message;
     die;
 }
开发者ID:nurikk,项目名称:EvilRocketFramework,代码行数:15,代码来源:UserMessage.php

示例9: postDispatch

 public function postDispatch()
 {
     $layouts = array_reverse($this->_layouts);
     $mvcLayout = Zend_Layout::getMvcInstance();
     $mvcContentKey = $mvcLayout->getContentKey();
     $content = $this->getResponse()->getBody();
     $view = $this->_cloneView();
     $layout = new Zend_Layout(array('layoutPath' => $mvcLayout->getLayoutPath(), 'viewSuffix' => $mvcLayout->getViewSuffix()));
     $layout->setView($view);
     foreach ($layouts as $layoutName) {
         $layout->setLayout($layoutName);
         $layout->{$mvcContentKey} = $this->getResponse()->getBody();
         $this->getResponse()->setBody($layout->render());
     }
 }
开发者ID:rdallasgray,项目名称:bbx,代码行数:15,代码来源:NestedLayouts.php

示例10: _buildTextBody

 /**
  * Build the txt part of the email using the provided scripts
  *
  * @return void
  */
 private function _buildTextBody()
 {
     $viewContent = '';
     if ($this->getTxtView()) {
         $viewContent = $this->view->render($this->getTxtView());
         if (!$this->getTxtLayout()) {
             // no layout, render only the view
             $this->setBodyText($viewContent);
         }
     }
     if ($this->getTxtLayout()) {
         $this->_layout->setLayout($this->getTxtLayout());
         $this->_layout->setView($this->view);
         // assign rendered view to the layout
         $this->_layout->assign('content', $viewContent);
         // render the layout
         $this->setBodyText($this->_layout->render($this->getTxtLayout()));
     }
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:24,代码来源:Mvc.php

示例11: testMinimalViewObjectWorks

 public function testMinimalViewObjectWorks()
 {
     require_once dirname(__FILE__) . '/_files/MinimalCustomView.php';
     $layout = new Zend_Layout(array('view' => new Zend_Layout_Test_MinimalCustomView(), 'ViewScriptPath' => 'some/path'));
     $layout->render();
 }
开发者ID:hjr3,项目名称:zf2,代码行数:6,代码来源:LayoutTest.php

示例12: testLayoutWithViewBasePath

 public function testLayoutWithViewBasePath()
 {
     $layout = new Zend_Layout(array('viewBasePath' => dirname(__FILE__) . '/_files/layouts-basepath/'));
     $this->assertEquals('layout inside basePath', $layout->render());
     $layout->setLayout('layout2');
     $this->assertEquals('foobar-helper-output', $layout->render());
 }
开发者ID:jon9872,项目名称:zend-framework,代码行数:7,代码来源:LayoutTest.php

示例13: getMailContent

 /**
  * Render mail content using a view and template 
  * 
  * @param string $template
  * @param array $substitutions
  * @param array $placeholders
  * @param string $mode
  * @param string $layout
  * @param string $layoutPath
  */
 public function getMailContent($template, $substitutions, $placeholders = array(), $mode = 'html', $layout = null, $layoutPath = null)
 {
     // Create the return variable
     $return = '';
     // Create a view renderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
     $view = clone $viewRenderer->view;
     // Create a layout object and set it to app_path/emails/layouts
     if ($layoutPath === null || $layoutPath == '') {
         $layoutPath = PUBLIC_PATH . $view->templateUrl('') . 'email' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR;
     }
     // Create the layout object
     $layoutObject = new Zend_Layout($layoutPath);
     // Add the script path to the view that overrules the default path
     $application = $this->getFrontController()->getParam('application');
     $module = $this->getRequest()->getModuleName();
     $scriptPath = $view->layout()->getViewScriptPath() . '/views/' . $application . '/modules/' . $module . '/';
     if (!in_array($scriptPath, $view->getScriptPaths())) {
         $view->addScriptPath($scriptPath);
     }
     // Add the default email folder for the layout/template
     $view->addScriptPath(PUBLIC_PATH . $view->templateUrl('') . 'email' . DIRECTORY_SEPARATOR . 'views');
     // Assign all substitutions (e.g. view variables) to the view view
     foreach ($substitutions as $key => $sub) {
         $view->{$key} = $sub;
     }
     // Replace all placeholders
     if (is_array($placeholders)) {
         foreach ($placeholders as $key => $sub) {
         }
     }
     // Set the view object to the layout object
     $layoutObject->setView($view);
     // Initialize a default layout
     if ($layout === null || $layout == '') {
         $layout = 'default';
     }
     switch ($mode) {
         case 'html':
             // Render html version of template & assign to $return
             $layoutObject->content = $view->render($template . '.html.phtml');
             // Set the layout
             $layoutObject->setLayout('' . $layout . '.html');
             // Render the layout output
             $return = $layoutObject->render();
             // Assimilate the stylesheet in the html
             $stylesheet = $layoutPath . $layout . '.css';
             if (file_exists($stylesheet)) {
                 $stylesheetContent = file_get_contents($stylesheet);
                 $test = new CSSToInlineStyles($return, $stylesheetContent);
                 $return = $test->convert(true);
             }
             break;
         case 'text':
             // Render text version of template & assign to $return
             $layoutObject->content = $view->render($template . '.text.phtml');
             // Set the layout
             $layoutObject->setLayout('' . $layout . '.text');
             // Render the layout output
             $return = $layoutObject->render();
             break;
     }
     // Replace the placeholders in the content
     $return = $this->_replacePlaceholders($return, $placeholders);
     // all done, return output
     return $return;
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:77,代码来源:Mail.php

示例14: testRenderWithCustomInflection

 public function testRenderWithCustomInflection()
 {
     $layout = new Zend_Layout();
     $view   = new Zend_View();
     $layout->setLayoutPath(dirname(__FILE__) . '/_files/layouts')
            ->setView($view);
     $inflector = $layout->getInflector();
     $inflector->setTarget('test/:script.:suffix')
               ->setStaticRule('suffix', 'php');
     $layout->message = 'Rendered layout';
     $received = $layout->render();
     $this->assertContains('Testing layouts with custom inflection:', $received);
     $this->assertContains($layout->message, $received);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:14,代码来源:LayoutTest.php


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