2009年11月27日星期五

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

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

没有评论: