zend-view

Where do I save partial (views) in Zend Framework, to be accessible for all Views in my App?

I have several view Partials (like paginator partial) which I want them to be available To all view scripts in my application. Is there a directory I can put partial vies in, and they will be available to all? Or, how do I define such a directory? ...

Launching a custom view from a custom model. Zend_possible?

You have to promise not to giggle, but my situation is following: Instead of using partials and helpers and other similar tools that we use already, we want to use a custom view outside all frames and borders of the actual application. Basically, we need at this point to load clean HTML into a variable upon a certain reaction a model. T...

How can I use Zend Layout with Zend View if I call the view from a model?

Basically, I want to render a view and layout from a model. Don't ask me why. First of all, the views work as intended and I'm loading them into a variable for my perverse use later on. I am also fully aware that I could always do partial scripts. It seems to be a valid fallback, but it just doesn't cut it. What I want to do is to get ...

Zend different view scripts?

Hi, I have a controller that passes input from a form into a model class to perform validation. If the validation is successful I want to allow the flow to continue and render the default view associated with the controller. My issue is that if validation is not successful then I want the model to pass back validation error messages an...

Zend Framework: Render multiple Views in one Layout

I want to generate a dynamic site using Zend_Layout. My layout (/application/layouts/scripts/layout.phtml) contains the following lines: ... <body> <?php echo $this->render('header.phtml') ?> <div id="content"><?php echo $this->layout()->content ?></div> <?php echo $this->render('footer.phtml') ?> ...

Sending variables to the layout in Zend Framework

Hi In my project I have a number of dynamic elements that are consistently on every page. I have put these in my layout.phtml My question is: How can I send variables into my layout from my controllers? If I want to send things from my controller I can use: $this->view->whatever = "foo"; And receive it in the view with echo $this-...

Calling "parent" view with Zend Framework

Imagine the following code: $view->addScriptPath('/path/to/base/scripts/'); $view->addScriptPath('/path/to/overload/scripts/'); With both paths containing the file index/index.phtml /path/to/overload/scripts/index/index.phtml: <p>Some paragraph.</p> Now I want /path/to/overload/scripts/index/index.phtml to overload the file above ...

How to switch layout files in Zend Framework?

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'); ?> ...

Zend Framework call view helper from a Zend_View_Helper

I have a helper called Zend_View_Helper_FormVars that's used by one of my modules. I also have a common helper in application/common/helpers/GeneralFunctions.php I'm trying to call a function from Zend_View_Helper_FormVars that's in GeneralFunctions.php Here is the sort version of Zend_View_Helper_FormVars class Zend_View_Helper_Form...

PHP syntax question, Zend Framework view script dilema...

So I want to use a jQuery tab container in my view script. I have tested it so I know I already have everything working. <?php $this->tabContainer()->addPane('container-name', 'label', 'content goes here'); ?> <?php echo $this->tabContainer('container-name'); ?> But this is the content that I want to put into the pane: <?php if (coun...

What do $this->escape() in zend framework actually do?

Hello guys, I need help in understanding the actual actions of a helper function in Zend Framework. I need someone to explain to me what $this->escape($string) actually does to the string passed to it before printing the string into the template. Thanks in advance ...

Get request info in view helper

Hello! Is it possible in Zend View helper (extends Zend_View_Helper_Abstract) get info about module/controller/action in which that helper was called ? ...

How to set current user in View?

I am using Zend Framework. I want the current user (if logged in) to always be available to the view. In my Bootstrap.php file I currently have: function _initViewHelpers() { $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); // <snip> $view-> set some stuff $v...

Zend navigation from action

<ul> <li> <a href="<?= $this->route('list', 'test1', 'default', array(), null, false) ?>">Test1 </a> </li> <li> <a href="<?= $this->route('list', 'test1', 'default', array(), null, false) ?>">Test2 </a> </li> <li> <a href="<?= $this->route('list', 'test3', 'default', array(), nu...

Searching for a javascript function definition within a string using PHP?

I'm using Zend_View_Helper_HeadScript to display javascript function definitions in the head of my webpages, and I extended it to get the javascript code from file if desired. What I'd like to know is if there would be an easy way to search the headScript output (basically, a series of xhtml script elements) for a javascript function de...

How to reencode url parameters with Zend Framework

I use the following code with my Zend Framework application: controller: $paramsOtherAction = $this->getRequest()->getParams(); $paramsOtherAction['action'] = 'otheraction' $this->view->paramsOtherAction = $paramsOtherAction; view: <a href="<?php echo $this->url($this->paramsOtherAction)?>"> Do other action with same params </a> T...

Handling one-to-many relationship with ZF partialLoop

Lets say i'm listing musical artists, each artist has basic information like Name, Age etc. stored in an artist table. They also have entries in an Albums table (album name/album cover etc), referencing the artist table using the artist id as a foreign key. I have the Model_Artist (Artist.php) file: class Model_Artist extends Zend_Db_...

zend_form ViewScript decorator / passing arguments

I have a form that is extend from Zend_Form. I am placing the form into a ViewScript decorator like this: $this->setDecorators(array(array('ViewScript', array('viewScript' => 'game/forms/game-management.phtml')))); I'd like to pass in a variable to this ViewScript but am not sure how this could be done. Since the partial renders out...

How do I use ViewScripts on Zend_Form File Elements?

I am using this ViewScript for my standard form elements: <div class="field" id="field_<?php echo $this->element->getId(); ?>"> <?php if (0 < strlen($this->element->getLabel())) : ?> <?php echo $this->formLabel($this->element->getName(), $this->element->getLabel());?> <?php endif; ?> <span class="value"><?php echo $this->...

Override Separator on Zend_Form Radio Elements When Using a ViewScript Decorator

I am using ViewScripts to decorate my form elements. With radio elements, the separator can normally be overridden, but the override is being ignored when I use the ViewScript. When I use the below call and ViewScript, the radio elements are separated by a '<br />' rather than the space I've specified. If leave the default decorators,...