I don't know if this is 100% correct... I made this once so...
1. in your view setup you give the path to find the helpers:
class My_Controller_Plugin_ViewSetup extends Zend_Controller_Plugin_Abstract
{
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->init();
$view = $viewRenderer->view;
$dir = dirname(__FILE__) . '/../../../../app/views/helpers'; // path
to the main view helpers
$view->addHelperPath($dir);
}
2. builder your helpers eg:
class Zend_View_Helper_GiveMeThis
{
function GiveItToMe()
{
return "bla bla bla";
}
}
3. in your layout.phtml
<?php echo $this->GiveItToMe(); ?>
jamilhassanspain wrote:
>
> I have some variables in my config.ini file that will be used to set
> content in some places in the layout.phtml ( this is the main template
> file that the website loads from ) ..
>
> These are places in the layout.phtml file like:
>
> a) page title
> b) and other contants in javascript inline scripts..
>
> I'm asking what is the best way to do this..
>
> I realize one way is to put code in the init() function of the controller
> that will assign the Zend_Registry values to
> $this->view->layout()->#variablename# = value;
>
> Is there any other way to do this with helper and if so, how can I set
> that up..
>
> Let me know..
>
> Thanks
>
> Jamil
>
-----
visit my website at http://www.phpscriptor.com/ http://www.phpscriptor.com/
--
View this message in context:
http://www.nabble.com/assigning-variables-inside-the-layout.phtml-file-tp21633607p21634130.html
Sent from the Zend Framework mailing list archive at Nabble.com.