You should always extend a custom view helper from the base class:
Zend_View_Helper_Abstract
As soon as you do this, the view instance is available via: $this->view
and there you could use $this->view->url() as well.
Regards,
Christoph
Am 27.11.2009 06:16, schrieb prado:
> Hi I have got a simple view helper which is sitting inside views/helpers
> directory that generates a list of links
>
> class Zend_View_Helper_Catmenu
> {
> public function Catmenu($cats)
> {
> $catMenu='';
>
> foreach ($cats as $cat)
> {
> $catMenu .= "<li> \"<b /cats/index/cat/$cat[cat_url]\">$cat[cat]</li>";
> }
>
> return $catMenu;
> }
>
> }
>
>
> I would like to use the url helper which is in this case "echo
> $this->url(array('controller'=>'cats', 'action'=>'index',
> 'cat'=>$cat[cat_url]));" for the highlighted code above. As I am not in the
> view i won't be able to access the url helper.
>
> Any other way to access a helper inside my custom helper, like in this
> example
>
--
------------------------------------------------------------
Christoph Rust
Senior Software Developer
von Affenfels GmbH
Kronenstraße 40
D-70174 Stuttgart
Telefon +49 (0) 711 305 890-36
Telefax +49 (0) 711 305 890-90
http://www.vonaffenfels.de | christoph.rust@vonaffenfels.de
Sitz der Gesellschaft: Stuttgart
Handelsregister Stuttgart HRB 728101
Geschäftsführer: Christian Jehle, Jürgen Knispel
没有评论:
发表评论