2009年11月27日星期五

Re: [fw-mvc] access url view helper from my custom view helper

Why do you want to extend an other helper?
Wie the abstract base class you can access every registered helper in the whole view.
Like $this->view->url() you can also use every other out-of-box helpers like partial or even your own helpers.

Am 27.11.2009 09:55, schrieb Jigal sanders:
Can't you just extend the view class? Like

class Zend_View_Helper_Catmenu extends Zend_View(_Helper) or something like this? ? 

On Fri, Nov 27, 2009 at 6:16 AM, prado <pradosh_k@hotmail.com> wrote:

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
--
View this message in context: http://n4.nabble.com/access-url-view-helper-from-my-custom-view-helper-tp788528p788528.html
Sent from the Zend MVC mailing list archive at Nabble.com.



--
Met vriendelijke groet,

Jigal Sanders
A.J. Ernststraat 739
1082 LK Amsterdam
Mobiel: 06-42111489

--  ------------------------------------------------------------    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 

没有评论: