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


PHP Zend_Layout::setView方法代码示例

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


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

示例1: __construct

 /**
  * Instance of construct
  * 
  * @param string $layout
  * @param array $options
  */
 public function __construct($layout = 'email', array $options = array())
 {
     $this->frontController = \Zend_Controller_Front::getInstance();
     $resources = $this->frontController->getParam('bootstrap')->getOption('resources');
     if (isset($options['layout'])) {
         $this->layout = new \Zend_Layout($options['layout']);
     } elseif (isset($resources['layout'])) {
         $this->layout = new \Zend_Layout($resources['layout']);
     } else {
         $this->layout = new \Zend_Layout();
     }
     if (isset($options['view'])) {
         $this->layout->setView(new \Zend_View($options['view']));
     } elseif (isset($resources['view'])) {
         $this->layout->setView(new \Zend_View($resources['view']));
     } else {
         $this->layout->setView(new \Zend_View());
     }
     $scriptPath = APPLICATION_PATH . self::EMAIL_PATH;
     if (null !== $this->frontController->getModuleDirectory()) {
         $scriptPath = $this->frontController->getModuleDirectory() . self::EMAIL_PATH;
     }
     $this->layout->setLayout($layout);
     $this->setScriptPath($scriptPath);
 }
开发者ID:lciolecki,项目名称:zf-extensions-library,代码行数:31,代码来源:Html.php

示例2: _prepareLayout

 /**
  * Prepare layout instance to be used
  *
  * @return void
  */
 private function _prepareLayout()
 {
     // set the view object
     $this->_layout->setView($this->view);
     // set the layout path
     $this->_layout->setLayoutPath($this->getApplicationPath() . '/layouts/scripts/');
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:12,代码来源:Mvc.php

示例3: setLayout

 /**
  *
  * Layout setter. If no layout indicated a new one is created.
  * @param Zend_Layout $layout
  */
 public function setLayout(Zend_Layout $layout = null)
 {
     if (isset($layout)) {
         $this->_layout = $layout;
         $this->_layout->setView($this->getView());
     } else {
         $this->getLayout();
     }
     return $this;
 }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:15,代码来源:Mail.php

示例4: 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

示例5: testViewAccessorsAllowSettingView

 /**
  * @return void
  */
 public function testViewAccessorsAllowSettingView()
 {
     $layout = new Zend_Layout();
     $view = new Zend_View();
     $layout->setView($view);
     $received = $layout->getView();
     $this->assertSame($view, $received);
 }
开发者ID:hjr3,项目名称:zf2,代码行数:11,代码来源:LayoutTest.php

示例6: 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

示例7: setOptions

 /**
  * Set Options from an Array
  *
  * @param array $options
  * @return Bgy\Mail\Template Provides fluent interface
  */
 public function setOptions(array $options = array())
 {
     if (isset($options['view'])) {
         $view = $options['view'];
         if (is_string($view)) {
             $view = new $view();
         }
     } else {
         // Set default view to Zend_View
         $view = new \Zend_View();
     }
     unset($options['view']);
     if (isset($options['layout'])) {
         $layout = $options['layout'];
         if (is_string($layout)) {
             $layout = new $layout();
         }
     } else {
         // Default layout to Zend_Layout
         $layout = new \Zend_Layout();
     }
     if (isset($options['htmlRenderer'])) {
         $htmlRenderer = $options['htmlRenderer'];
         if (is_string($htmlRenderer)) {
             $htmlRenderer = new $htmlRenderer();
         }
     } else {
         // Default provided Html Renderer to convert Html to Text
         $htmlRenderer = new Template\Html\Renderer\SimpleText();
     }
     $this->setHtmlRenderer($htmlRenderer);
     unset($options['htmlRenderer']);
     $layout->setView($view);
     $this->setLayout($layout);
     $this->setView($view);
     unset($options['layout']);
     if (!isset($options['layoutScript'])) {
         // Default layout script name 'layout'
         $options['layoutScript'] = 'layout';
     }
     foreach ($options as $key => $value) {
         $method = 'set' . ucfirst($key);
         if (method_exists($this, $method)) {
             $this->{$method}($value);
         }
         unset($options[$key]);
     }
     return $this;
 }
开发者ID:exstas87,项目名称:bgylibrary,代码行数:55,代码来源:Template.php

示例8: injectResources

 /**
  * Creates simulated resources and injects them into the given bootstrapper.
  *
  * @param Mol_Test_Bootstrap $bootstrapper
  */
 protected function injectResources(Mol_Test_Bootstrap $bootstrapper)
 {
     $bootstrapper->simulateResource('log', new Zend_Log($this->logWriter));
     $view = $this->createView();
     $bootstrapper->simulateResource('view', $view);
     $layout = new Zend_Layout();
     $layout->setView($view);
     $view->getHelper('layout')->setLAyout($layout);
     $bootstrapper->simulateResource('layout', $layout);
 }
开发者ID:matthimatiker,项目名称:molcomponents,代码行数:15,代码来源:WebControllerTestCase.php


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