zend-view

Using actionHelper without returning layout in output

I call an action helper in one of my views using the following code echo $this->action('foo', 'bar'); The fooAction in the barController does its thing and outputs a list of pages. However, the list has the layout in the output again, which is mightily irritating. If I disable the layout in the fooAction, this causes layout to be comp...

Render view in higher script path with Zend Framework

Lets assume the following code within a controller: $this->view->addScriptPath('dir1/views/scripts'); $this->view->addScriptPath('dir2/views/scripts'); $this->render('index.phtml'); Where dir1/views/scripts contains 2 files: -index.phtml -table.phtml And dir2/views/scripts: -table.phtml Now, it will render the index.phtml i...

Zend Framework - Last Code to Execute Before Layout is Rendered

I want to execute some code right before the layout is rendered, after all other code is executed. Where would I put that code? I am specifically trying to modify the files referenced in the headLink, headScript, and inlineScript view helpers before they're used by the layout. Here are the steps I want to take: Loop over the files i...

Modify Stack in the Zend HeadScript View Helper

I am trying to attack this problem from a completely different angle, because it doesn't look like I can achieve my goal that way. I want to loop over the item stack in the HeadScript View Helper, and make modifications to it. The documentation for this and some of the other view helpers makes this statement: HeadScript overrides e...

Is there a way to generate views from Zend_Form ? (read-only)

I was wondering if is there an easy way to generate views from form objects when dealing with CRUDs. I mean, when we have these options: VIEW | EDIT | DELETE I want my VIEW option like EDIT option, but without form elements, just the values. This will minimize so much the time spent to create these views. Someone knowks something like...

How do I extend the Zend Navigation Menu View Helper?

I need to change the output of Zend_View_Helper_Navigation_Menu. I've found the two functions that I'll need to modify, and I know how to make the changes I need. What I don't know is how to make the Navigation object use my view helper instead of the Zend one. Code snippet representing my class extension: // file /library/My/View/He...

zend framework bootstrap objects for controllers?

Hello, ATM I set the currency and locale objects in the bootstrap and assign them to zend registry. Then in the controller that needs them, In the init I do: public function Init() { $this->locale = Zend_Registry::get('locale'); $this->currency = Zend_Registry::get('currency'); } I was wondering if there's away to make v...

[Zend_View] Tabs contain object (embedding documents)

Hi, My project is based on MVC architecture and I have a UI design pattern problem. I have several tabs which contain object as show in the picture. My first idea was to link a tab to one view (phtml) so in the document each tabs is an embedding document. The tab contains an element with an url to a page. I show you a piece of code. T...

Extending Zend View Helper Placeholder

I was reading the manual about basic placeholder usage, and it has this example: class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { // ... protected function _initSidebar() { $this->bootstrap('View'); $view = $this->getResource('View'); $view->placeholder('sidebar') // "pref...

trying to show a variable in my layout

hi i have a simple question where is my code wrong ? in index controller and index action i put $this->view->username="user1"; and when i try in my layout i use echo $this->username; i got fllowing error or null value Notice: Trying to get property of non-object in D:\Zend\Apache2\htdocs\test\application\layouts\layout.phtml...

Inject filter into Zend_View

Hi! I wish to set some properties in MyFilter with constructor injection but it seems impossible with Zend_View::addFilter(string $filter_class_name) since it loads a new instance upon usage. MyFilter implements Zend_Filter_Interface. Can I somehow inject an instance of a filter to an instance of Zend_View? Closing since it (hopefully...

How to use global view files in Zend Framework?

Hi, I am trying to use global or shared view files. Let's say I have a module in Application/Modules/default and I have "IndexController.php" inside "default/controllers" within "IndexController", I would like to render a view that is located in "Application/Views". I tried to use addScriptPath, but Zend_View tries to look "Applicati...

Inline Zend Navigation links in view content saved to db

I'm storing the page content in the database (both as markup and HTML code) and displaying this content in the view (let's say it's CMS or forum post). The this data have also some links to internal pages existing in sitemap (Zend_Navigation object). It's easy to insert the link in page body just by using <a> tag. But the contents of th...

Overwrite zend view directory?

Hello, In my bootstrap, I detect the site the users on, then issue the layout change and helper change. Essentially anything that is there by default is what the site falls back on if there is no per site version in /public/site/ However I cannot get the actual view to rely on a path a give it or a path in /public/site. Here is my cod...

Set custom template path to render instead of standard one

Hello ! Is it possible in ZendFramework to set custom template when I call some action ? For example I call /category/show/id/123 and View is rendering /category/show.html file. I want to be able to render anonther template - /category/showOther.html. What should I do ? ...

What's the best way to escape vars in Zend_View automatically?

A week or two ago I just started using Zend Framework seriously and have had trouble escaping manually with Zend_View::escape(). Does anyone knows how to escape vars in templates (Zend_View templates) automatically without using $this->escape(), or any other tricky ways like output buffering and PREG replacing *.phtml files. I'd like to...

How we should use zend view helper form with validators + filters?

Hi, How we should use zend view helper form with validators + filters? Example that miss validators + filters from: http://framework.zend.com/manual/en/zend.view.helpers.html <form action="action.php" method="post"> <p> <label>Your Email: <?php echo $this->formText('email', '[email protected]', array('size' => 32)) ?> </label> ...

Zend_Form:: When should be form created in view and not in controller?

Hi, Zend_Form:: When should be form created in view and not in controller? option 1 - form created in controller and passed to view (usually used) controller: $form=new MyForm(); $this->view->form=$form; view: echo $this->form; option 2 - form created in view directly (looks better to me because form its subpart of view) view:...

Zend Framework - Reusing view header information across Controller

In Zend Framework, I have a common use case where I need to propagate the same information in the top section of a view across a particular controller. For example, if I have a "Book" controller, I want to display the summary book information at the top of the page, and have a tabbed interface below the book to display comments, detaile...

Need help figuring out how to write my zend view helper

Hello I'm fairly new to Zend Framework and MVC in general so I'm looking for some advice. We have a base controller class in which we have some methods to obtain some user information, account configurations, etc. So I'm using some of those methods to write out code in various controllers actions, but now I want to avoid duplicating th...