ZF-2403: Zend_View_Helper_Head* muilt view support

Description

When you call


$this->action('index2');

inside an action and the index2 action calls this


$this->headLink()->appendStylesheet('/css/talkback.css');
$this->headScript()->appendFile('/js/talkback/threaded.js');

whatever is added with head* helper in the second action does not get appended to the layout when it's rendered.

Comments

When you say "inside an action", do you mean inside an action controller method? I need more context.

The action() view helper by itself does not act as a placeholder, it simply returns content; as such, if you want it to appear in the layout script, you need to either put it in a placeholder, or include it in content that will be aggregated into the layout.

Ok here is what i do.

i request a page lets say http://test.com/news/story/My_Story

In my setup that would make it Module of news controller of story and the defualt index action as My_Story is the title of the story which is how I know which story to fetch from the db. inside of the index action i call get the story and assign it to a view.

inside of my view script i have the code to out put the story.

at the bottom of the view script i call this code.


<?= $this->action('index', 'news', 'talkback', array('story_id' => $this->story->release_id)) ?>

which call the talkback module news controller index action which if talkback exists for the passed in release then it will spit out the necessary code for the talkback module on the page.

The way i think this should work is that i should beable to specify any addition css/js/meta data that is needed in that action even though it's begin call through the action helper.

Doest that make sense?

When you say "inside of my view script", is this the view script rendered for the action, or your layout script?

If the call to $this->action() is occurring in your layout script, then this won't work; it's being executed after the other helpers have already created their output. If it's happening in your view script, but before the layout script is rendered, then there's a definite issue.

Could you confirm the sequence of events?

it it called from the action and not the layout.

so i call $this->render('designs') at the end of an action to render the designs.phtml for the current module. Inside side of that i have the $this->action('design_nav','navigation','designid', array()) call to render the local navigation or some other piece of this page. but when i try add scripts or css files from that action they do not get added.

does that make sense?

Changing release target to next minor release, as functionality will not be released before then.

Resolved in trunk; please test.