zend-layout

Set indent on view in Zend Framework

流过昼夜 提交于 2020-01-04 05:45:10
问题 In Zend Framework, it is possible to set indentation for headMeta(), headLink(), etc: <?= $this->headLink()->setIndent("\t\t") ?> I like this. I like things tidy. So, now I would want to indent my entire view as well in the layout.phtml file, causing every new line in the view script to be indented with X tabs. <?= $this->layout()->setIndent("\t\t")->content ?> This does not work. Is there any way to do this within Zend Framework without having to intercept the output with ob_start? 回答1: Zend

setting layout file for module inside bootstrap in zend

痞子三分冷 提交于 2019-12-23 02:56:22
问题 My zend application structure: application ->configs ->layouts ->scripts ->admin.phtml ->site.phtml ->modules ->admin(controllers, models, views) ->Bootstrap.php ->default(controller,models,views) ->Bootstrap.php I have set the default layout in my application.ini as: resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.layout.layout = "site" I have two modules: admin and default. How to set the layout file (admin.phtml)for admin module? I want to change the layout from

Can i have multiple layouts in Zend Framework?

此生再无相见时 提交于 2019-12-21 19:54:05
问题 I have a flashy page with image rotators in the front end for the clients. For back-end I want to have different layout. Can i have multiple layout? A little hint would be appreciable 回答1: I create a layout plugin, to switch layouts when a non-default module is called: class MyApplication_Layout_Controller_Plugin_Layout extends Zend_Layout_Controller_Plugin_Layout { public function preDispatch(Zend_Controller_Request_Abstract $request) { switch ($request->getModuleName()) { case 'admin':

How capture the default.phtml in a variable inside a controller

走远了吗. 提交于 2019-12-12 18:52:05
问题 I have a simple question... How could I render the contents of the default.phtml which is in Project/application/layouts/scripts/default.phtml to a variable, so I can have its html. In the index controller, with an action and a phtml file named test, this would work: $html = $this->view->render('index/test.phtml'); But, of course, this does not: $htmlDefaultLayout = $this->view->render('default.phtml'); Since default.phtml is not inside any controller, I guess. Is there a good way to do that?

Adobe Reader cannot open .pdf file created using mPDF in Zend Framework

房东的猫 提交于 2019-12-12 16:04:20
问题 I'm trying to generate a .pdf file using mPDF in a Zend Framework application, from the output of the action. Here is the code of my action: public function testAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); $this->view->foo = 'bar'; $this->render(); $output = $this->getResponse()->getBody(); $layout = new Zend_Layout(); $layout->content = $output; $layout->setLayoutPath(dirname(dirname(__FILE__)) . '/views/layouts/'); $layout->setViewSuffix(

How do I pass variables to a layout in a multiple module / layout Zend Framework application?

夙愿已清 提交于 2019-12-11 05:36:02
问题 Before I converted my Zend Framework application to a module based structure, it had a single layout and I could pass variables to it from my controller like so: // Controller action $this->view->foo = 'Something'; // Layout <?= $this->foo ?> However, since moving everything into a default module and creating a separate "admin" module, I can no longer get this to work, most likely due to me moving my "View Settings" out of my bootstrap file and into the controller plugin where I am switching

Zend_Dojo_Form in a layout

早过忘川 提交于 2019-12-10 17:56:57
问题 I have a Zend_Dojo_Form which I have moved from my view (where it works fine) to my layout, as it's something that will be useful on every page. However in the layout the form no longer works - none of the dijit elements appear and it behaves just as a normal HTML form would. Here's the relevant part of my bootstrap: protected function _initView() { Zend_Layout::startMvc(array( 'layoutPath' => '../application/layouts', 'layout' => 'default' )); $view = new Zend_View(); $view->setEncoding('UTF

How to move the “views” of Zend_Layout

元气小坏坏 提交于 2019-12-06 10:14:58
问题 Normally it would be in such a structure: ../application/modules/somemodule/views/scripts/index/index.phtml How I move it to: ../application/templates/somemodule/template1/views/...... ../application/templates/somemodule/templateTWOOMG/....... ?? 回答1: You need to play with: $viewRenderer::setViewBasePathSpec(); For example in frontController plugin, (or easier, but not so flexible, in Bootstrap.php ): $templateName = 'myTemplate'; $bootstrap = $this->getBootstrap(); $bootstrap->bootstrap(

Zend Framework - Set No Layout for Controller

荒凉一梦 提交于 2019-12-04 18:03:13
问题 I have a Controller that I want to use for ajax scripts to call and set session variables, get information, etc. How do I set it so that that particular controller doesn't use the default layout (specifically NO layout) so that it can send XML/JSON messages back and forth? 回答1: Like anything to do with Zend_Framework and Zend_Application, there are multiple ways to do this, but on the last few pure Zend gigs I've done, I've seen people using the following (from an action method in you

How to switch layout files in Zend Framework?

我的梦境 提交于 2019-12-04 07:36:49
问题 I'm sure it's a simple one-liner, but I can't seem to find it. How can I use a different layout file for a particular action? Update: This worked for me, thanks! // Within controller $this->_helper->_layout->setLayout('other-layout') //other-layout.phtml //Within view script <?php $this->layout()->setLayout('other-layout'); ?> 回答1: From inside a Controller: $this->_helper->layout->setLayout('/path/to/your/layout_script'); (via these docs) EDIT: I should mention that the path is relative to