English 中文(简体)
2. Java语 Sheet from View_Helpers calls in a Layout
原标题:Append JavaScript or StyleSheet from View_Helpers called inside a Layout

is it possible to make it happen? My view helper works fine if in a view that was a result of a controll. But I would like to have some dinamic layout, for example, to render a jquery menu according to the state I m in.

如果我打电话给帮助者,不要听从传票,我确实在助手里。

感谢!

最佳回答

You have a couple of options here.
the easiest way to do what you want would be to use the inlineScript() view helper and add it to the view in the bootstrap or directly in the layout script. The inlneScript() helper works the same way as the headScript() helper but puts the code in the markup. I sometimes use the inlineScript() helper to pass configuration data to audio and video players.

Alternatively you can build your own placeholder using your view helper and just initialize it in the bootstrap.

http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers. initial.placeholder” rel=“nofollow”>placeholder 。 因此:

诱杀装置:

 protected function _initMenus() {
        //get view object
        $view = $this->getResource( view );
        //assign the id for the menus...
        $view->mainMenuId = 4;
        $view->adminMenuId = 5;
    }

编造:

<?php
$this->layout()->adminMenu = $this->action(
         render ,  menu , null, array( menu  => $this->adminMenuId))
?>
<div id="adminMenu">
     <!-- Render the placeholder -->
     <?php echo $this->layout()->adminMenu ?>&nbsp;
</div>

这名持有人只是使用 helper to calls a makeAction(......),但你与土地持有人做些什么却受到你的想象力的限制。

问题回答

我认为,这样做是可能的,因为如果帮助者被安排在布局中,他们很可能在头版助手开台后叫上台。 取得这一努力的唯一途径是,在头版之前,确保你的助手在布局的顶端附近被召到。





相关问题
Zend 邮件问题,涉及外国char子+ com子

泽斯德邮局在名称被定为具有外国性质(如“保”)和 com(”)的物品时,就放弃了一种例外(因为邮局(邮局)退回假)。 重新提出以下守则。

PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

Tagging with Zend Framework

I m trying to create the same solutions as below, but using a simple MySQL query (instead of the static version used below where the words/tags are implemented in the code). The name of the MySQL ...

dynamicaly adding textboxes to zend_form

I hope that this is a quick question to answer. I am developing a form using Zend_Form, I have a number of Zend_Dojo_Form_Element_Textboxs to add to this form dynamically. These are added from rows ...

热门标签