Questions tagged [zend-view]

provides the “View” layer of Zend Framework 2’s MVC system. It is a multi-tiered system allowing a variety of mechanisms for extension, substitution, and more.

zend-view
Filter by
Sorted by
Tagged with
1 vote
2 answers
294 views

Need help figuring out how to write my zend view helper

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 ...
SBUJOLD's user avatar
  • 1,463
11 votes
3 answers
10k views

Zend Framework - Set No Layout for Controller

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 (...
ashurexm's user avatar
  • 6,259
2 votes
3 answers
2k views

Zend Framework: Check if Zend View Placeholder isset

How can I check if a Zend View Placeholder isset before echo-ing it out? As I am wanting to prepend " - " to it before outputting it. I tried echo isset($this->placeholder('title')) ? ' - '...
Jiew Meng's user avatar
  • 85.9k
1 vote
2 answers
689 views

Zend Framework: Difference between View Partials & Helpers

partials and helpers seem to do similar things to me. only the way u use it, syntax, is different, so my question is whats the difference and when do u use one over the other
Jiew Meng's user avatar
  • 85.9k
2 votes
2 answers
359 views

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 ...
clarkstachio's user avatar
2 votes
4 answers
317 views

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

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->...
Ben's user avatar
  • 25.6k
0 votes
1 answer
1k views

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

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....
Ben's user avatar
  • 25.6k
2 votes
5 answers
1k views

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) ...
chikaram's user avatar
  • 720
6 votes
2 answers
8k views

Set custom template path to render instead of standard one

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 ...
hsz's user avatar
  • 150k
0 votes
3 answers
2k views

Overwrite zend view directory?

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 ...
azz0r's user avatar
  • 3,292
0 votes
2 answers
882 views

How to call a view from a view in Zend Framework? [duplicate]

I need to render a view from inside a view. For the sake of question, i'll call them blocks. I have 5 controllers, each of them has an action that is called BlockAction(), and it displays some of ...
Janis Peisenieks's user avatar
0 votes
5 answers
647 views

Inject filter into Zend_View

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 ...
chelmertz's user avatar
  • 20.5k
2 votes
2 answers
775 views

trying to show a variable in my layout

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 ...
user1400's user avatar
  • 1,409
2 votes
1 answer
2k views

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() { ...
Sonny's user avatar
  • 8,296
10 votes
3 answers
9k views

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 ...
Sonny's user avatar
  • 8,296
1 vote
5 answers
2k views

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, ...
Keyne Viana's user avatar
  • 6,204
2 votes
1 answer
2k views

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, ...
Sonny's user avatar
  • 8,296
1 vote
1 answer
3k views

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 ...
Sonny's user avatar
  • 8,296
1 vote
3 answers
2k views

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'); ...
sander's user avatar
  • 53
0 votes
1 answer
77 views

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 ...
Philip Bennison's user avatar
1 vote
3 answers
8k views

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 ...
Sonny's user avatar
  • 8,296
19 votes
7 answers
16k views

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->...
Sonny's user avatar
  • 8,296
5 votes
3 answers
5k views

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-...
timpone's user avatar
  • 19.6k
1 vote
1 answer
856 views

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), ...
robjmills's user avatar
  • 18.5k
0 votes
2 answers
2k views

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->...
Peter Smit's user avatar
  • 28.2k
2 votes
2 answers
416 views

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 ...
Robin M. Canaday's user avatar
1 vote
3 answers
2k views

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->...
Matt McCormick's user avatar
15 votes
1 answer
15k views

Get request info in view helper

Is it possible in Zend View helper (extends Zend_View_Helper_Abstract) get info about module/controller/action in which that helper was called ?
hsz's user avatar
  • 150k
13 votes
3 answers
17k views

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

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 ...
IndexController's user avatar
0 votes
1 answer
334 views

PHP syntax: Zend Framework view script dilemma

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', '...
Andrew's user avatar
  • 233k
8 votes
4 answers
10k views

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 ...
EricP's user avatar
  • 1,459
60 votes
2 answers
44k views

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->...
Andrew's user avatar
  • 233k
39 votes
8 answers
42k views

Sending variables to the layout in Zend Framework

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? ...
user avatar
8 votes
4 answers
34k views

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->...
Michi's user avatar
  • 223
8 votes
4 answers
11k views

Zend different view scripts?

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 ...
db83's user avatar
  • 169
0 votes
2 answers
2k views

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 ...
John's user avatar
  • 261
3 votes
1 answer
732 views

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 ...
John's user avatar
  • 261
1 vote
1 answer
3k views

Zend Sessions Problem (beginner)

I'm teaching myself Zend am and having a problem with using my session to call a View Helper action. My controller: <?php class SessionController extends Zend_Controller_Action { protected ...
Ethan's user avatar
  • 5,719
14 votes
1 answer
14k views

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 ...
Itay Moav -Malimovka's user avatar
11 votes
6 answers
25k views

Getting basepath from view in zend framework

Case: you're developing a site with Zend Framework and need relative links to the folder the webapp is deployed in. I.e. mysite.com/folder online and localhost:8080 under development. The following ...
Mads Mobæk's user avatar
  • 35.4k

1 2 3 4 5
6