http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headlink
I'm not the right person to explain this, but its Sunday, the headLink
function is a view helper, and you are trying to call it from an action when
you use $this in the index action of a controller. I'm not sure of your
setup, but you may be able to use $this->view->headLink() from you action
depending on your setup. Another option would be to try the following in
your layout.phtml:
<? =
$this->headlink()->appendStylesheet($this->redirectUrl('/css/site.css')); ?>
Hope that helps. Hopefully someone else will chime in with a clearer
explanation.
Jim
phpbutcher wrote:
>
> In my learning process for trying to get my head around ZF I made a simple
> website using a layout. All went well until I read about placeholders and
> tried to implement some of them. I had no problem dropping
> $this->doctype('XHTML1_STRICT') into my layout.phtml and having it work
> just fine. But when I tried to use headLink() everything came to a
> screeching halt. In the index action of my controller I have
>
> $this->headLink()->appendStylesheet('/css/site.css');
>
> and in layout.phtml I have:
>
>
> <?= $this->headLink() ?>
>
> But that combination tosses an error in my lap:
>
> Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' with
> message 'Method "headLink" does not exist and was not trapped in
> __call().....
>
> I've tried to fiddle with it but I can't figure it out. Do I need to
> explicitly include the helper? It was my understanding from the docs that
> this one was built in, but I'm completely new to the ZF and I know I might
> be way off base.
>
> Thanks,
> Marty
>
>
>
--
View this message in context:
http://www.nabble.com/using-headLink-with-layout-tp16795623p16795649.html
Sent from the Zend Framework mailing list archive at Nabble.com.