I’ve been using the placeholder helper to send variables to my partials, which I think is similar to render(…).
$this->placeholder(‘script’)->set(‘event.js’);
---
<?php echo $this->placeholder(‘script’); ?>
Placeholders: http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.placeholder
HOWEVER, it looks like you’re trying to dynamically load difference JS scripts. I think the better solution to this is to do something like the following:
$this->view->headScript()->appendFile('/js/script.js','text/javascript',array('language' => 'JavaScript'));
---
<?= $this->headScript() ?>
-mike tramontano
From: Jigal sanders [mailto:jigalroecha@gmail.com]
Sent: Thursday, August 21, 2008 11:07 AM
To: Емил Иванов / Emil Ivanov
Cc: Zend Framework MVC
Subject: Re: [fw-mvc] question about view script
What would be the best way to have all the initial values of these helpers on one place?
I don't want to set the same values in each controller. How can i solve this in a nice way?
On Thu, Aug 21, 2008 at 3:31 PM, Емил Иванов / Emil Ivanov <emil.vladev@gmail.com> wrote:
Using scriptHead is a solution.
But I think your problem is with the variable setting:
> But when i say in my controller:
>
> $this->script = "event.js";
>
> then it doesn't work.
This should be $this->view->script = "event.js";
Regards
--
My place to share my ideas:
http://vladev.blogspot.com
--
Met vriendelijke groet,
Jigal Sanders
A.J. Ernststraat 739
1082 LK Amsterdam
Mobiel: 06-42111489
没有评论:
发表评论