<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using Action Helpers in Zend Framework</title>
	<atom:link href="http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/</link>
	<description>Developing PHP software in the Real World, by Rob Allen</description>
	<lastBuildDate>Mon, 15 Mar 2010 21:29:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: helmi</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-29763</link>
		<dc:creator>helmi</dc:creator>
		<pubDate>Mon, 21 Dec 2009 17:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-29763</guid>
		<description>ok found it 

[code]

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
	
 public function run()
    {
       
        
      $config = new Zend_Config_Ini(APPLICATION_PATH.&#039;/configs/application.ini&#039;);
		// On met notre fichier de config dans un registre.
        Zend_Registry::set(&#039;config&#039;, $config);  
        Zend_Controller_Action_HelperBroker::addPath(
        APPLICATION_PATH .&#039;/controllers/helpers&#039;);
        parent::run();
    }


[/code]</description>
		<content:encoded><![CDATA[<p>ok found it </p>
<p>[code]</p>
<p>class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {</p>
<p> public function run()<br />
    {</p>
<p>      $config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini');<br />
		// On met notre fichier de config dans un registre.<br />
        Zend_Registry::set('config', $config);<br />
        Zend_Controller_Action_HelperBroker::addPath(<br />
        APPLICATION_PATH .'/controllers/helpers');<br />
        parent::run();<br />
    }</p>
<p>[/code]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: helmi</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-29762</link>
		<dc:creator>helmi</dc:creator>
		<pubDate>Mon, 21 Dec 2009 16:49:34 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-29762</guid>
		<description>Hi Rob

I&#039;am beginner in zf 1.9 where do i write this code 
[code]
Zend_Controller_Action_HelperBroker::addPath(
        APPLICATION_PATH .&#039;/controllers/helpers&#039;);
[/code]


with my version(zf 1.9)

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Rob</p>
<p>I'am beginner in zf 1.9 where do i write this code<br />
[code]<br />
Zend_Controller_Action_HelperBroker::addPath(<br />
        APPLICATION_PATH .'/controllers/helpers');<br />
[/code]</p>
<p>with my version(zf 1.9)</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vibhor</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-26353</link>
		<dc:creator>Vibhor</dc:creator>
		<pubDate>Tue, 12 May 2009 13:25:01 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-26353</guid>
		<description>Hi,

Sorry for the formatting!
 

I am using a modular directory structure for my zend app. Here is the structure:
 
&lt;pre&gt;
Appname
 - frontend
   -modules
      -module1
         -controller
         -models
         -views
       -module2
          -controller
          -models
          -views
    -layouts
    -helpers
&lt;/pre&gt;


I need to have an action helper for my controllers

The helpers directory is where my action helper files will reside. In the bootstrap, I have done this:


$view-&gt;addHelperPath(FRONT_APPLICATION_PATH.&#039;/helpers&#039;);

 

This is the code that I have written for my new helper

class Zend_Controller_Action_Helper_Cim extends Zend_Controller_Action_Helper_Abstract

  {

    function direct($a) {

        return $a.&#039;from Helper&#039;;

    }

    

    function other($a) {

        echo $a.&#039;from Helper other&#039;;

    }

  }

 

And this is how I am calling in the controller:

$leadHelper = $this-&gt;_helper-&gt;getHelper(&#039;cim&#039;);

 echo $leadHelper-&gt;direct(&#039;asdasd&#039;);

 

I cannot see any error but also I do not see any output. Am I doing something wrong here. 

Any help will be appreciated.

 

Thanks,

Vibhor</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Sorry for the formatting!</p>
<p>I am using a modular directory structure for my zend app. Here is the structure:</p>
<pre>
Appname
 - frontend
   -modules
      -module1
         -controller
         -models
         -views
       -module2
          -controller
          -models
          -views
    -layouts
    -helpers
</pre>
<p>I need to have an action helper for my controllers</p>
<p>The helpers directory is where my action helper files will reside. In the bootstrap, I have done this:</p>
<p>$view-&gt;addHelperPath(FRONT_APPLICATION_PATH.'/helpers');</p>
<p>This is the code that I have written for my new helper</p>
<p>class Zend_Controller_Action_Helper_Cim extends Zend_Controller_Action_Helper_Abstract</p>
<p>  {</p>
<p>    function direct($a) {</p>
<p>        return $a.'from Helper';</p>
<p>    }</p>
<p>    function other($a) {</p>
<p>        echo $a.'from Helper other';</p>
<p>    }</p>
<p>  }</p>
<p>And this is how I am calling in the controller:</p>
<p>$leadHelper = $this-&gt;_helper-&gt;getHelper('cim');</p>
<p> echo $leadHelper-&gt;direct('asdasd');</p>
<p>I cannot see any error but also I do not see any output. Am I doing something wrong here. </p>
<p>Any help will be appreciated.</p>
<p>Thanks,</p>
<p>Vibhor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vibhor</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-26352</link>
		<dc:creator>Vibhor</dc:creator>
		<pubDate>Tue, 12 May 2009 13:22:58 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-26352</guid>
		<description>Hi Rob,

 

I am using a modular directory structure for my zend app. Here is the structure:

 

Appname

            - frontend

                        -modules

                                    -module1

                                                -controller

                                                -models

                                                -views

                                    -module2

                                                -controller

                                                -models

                                                -views

                        -layouts

                        -helpers

 

I need to have an action helper for my controllers

The helpers directory is where my action helper files will reside. In the bootstrap, I have done this:

 

$view-&gt;addHelperPath(FRONT_APPLICATION_PATH.&#039;/helpers&#039;);

 

This is the code that I have written for my new helper

class Zend_Controller_Action_Helper_Cim extends Zend_Controller_Action_Helper_Abstract

  {

    function direct($a) {

        return $a.&#039;from Helper&#039;;

    }

    

    function other($a) {

        echo $a.&#039;from Helper other&#039;;

    }

  }

 

And this is how I am calling in the controller:

$leadHelper = $this-&gt;_helper-&gt;getHelper(&#039;cim&#039;);

 echo $leadHelper-&gt;direct(&#039;asdasd&#039;);

 

I cannot see any error but also I do not see any output. Am I doing something wrong here. 


Thanks,

Vibhor</description>
		<content:encoded><![CDATA[<p>Hi Rob,</p>
<p>I am using a modular directory structure for my zend app. Here is the structure:</p>
<p>Appname</p>
<p>            - frontend</p>
<p>                        -modules</p>
<p>                                    -module1</p>
<p>                                                -controller</p>
<p>                                                -models</p>
<p>                                                -views</p>
<p>                                    -module2</p>
<p>                                                -controller</p>
<p>                                                -models</p>
<p>                                                -views</p>
<p>                        -layouts</p>
<p>                        -helpers</p>
<p>I need to have an action helper for my controllers</p>
<p>The helpers directory is where my action helper files will reside. In the bootstrap, I have done this:</p>
<p>$view-&gt;addHelperPath(FRONT_APPLICATION_PATH.'/helpers');</p>
<p>This is the code that I have written for my new helper</p>
<p>class Zend_Controller_Action_Helper_Cim extends Zend_Controller_Action_Helper_Abstract</p>
<p>  {</p>
<p>    function direct($a) {</p>
<p>        return $a.'from Helper';</p>
<p>    }</p>
<p>    function other($a) {</p>
<p>        echo $a.'from Helper other';</p>
<p>    }</p>
<p>  }</p>
<p>And this is how I am calling in the controller:</p>
<p>$leadHelper = $this-&gt;_helper-&gt;getHelper('cim');</p>
<p> echo $leadHelper-&gt;direct('asdasd');</p>
<p>I cannot see any error but also I do not see any output. Am I doing something wrong here. </p>
<p>Thanks,</p>
<p>Vibhor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikola</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-24856</link>
		<dc:creator>Nikola</dc:creator>
		<pubDate>Sun, 05 Apr 2009 14:34:54 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-24856</guid>
		<description>So you mean just to put those lines from init() to preDispatch()? 

Ok, but there&#039;s still a problem of copy/paste that code in every controller, or maybe I misunderstood something? :)</description>
		<content:encoded><![CDATA[<p>So you mean just to put those lines from init() to preDispatch()? </p>
<p>Ok, but there's still a problem of copy/paste that code in every controller, or maybe I misunderstood something? :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob...</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-24853</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Sun, 05 Apr 2009 13:24:58 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-24853</guid>
		<description>Nikola,

I would use the preDispatch() hook of an action controller to do that.

Regards,

Rob...</description>
		<content:encoded><![CDATA[<p>Nikola,</p>
<p>I would use the preDispatch() hook of an action controller to do that.</p>
<p>Regards,</p>
<p>Rob...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikola</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-24852</link>
		<dc:creator>Nikola</dc:creator>
		<pubDate>Sun, 05 Apr 2009 13:19:25 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-24852</guid>
		<description>Hi, 

I have a doubt about handling some jobs that needs to be executed across multiple controllers. To be more precise, here are things that need to be done:
//Setting compile dir for every module, because I use Smarty
$compile_dir = $this-&gt;view-&gt;getCompileDir(); 
$this-&gt;view-&gt;setCompileDir($compile_dir . &#039;/&#039; . $this-&gt;_request-&gt;getModuleName());

//Getting template dir that user has selected in admin panel.		
$settings = Zend_Registry::get(&#039;settings&#039;);
$this-&gt;view-&gt;theme = $settings[&#039;theme_dir&#039;];

Currently, I keep that code in init() method of every controller. Is there any better solution, maybe with those action helpers?

Thanks.</description>
		<content:encoded><![CDATA[<p>Hi, </p>
<p>I have a doubt about handling some jobs that needs to be executed across multiple controllers. To be more precise, here are things that need to be done:<br />
//Setting compile dir for every module, because I use Smarty<br />
$compile_dir = $this-&gt;view-&gt;getCompileDir();<br />
$this-&gt;view-&gt;setCompileDir($compile_dir . '/' . $this-&gt;_request-&gt;getModuleName());</p>
<p>//Getting template dir that user has selected in admin panel.<br />
$settings = Zend_Registry::get('settings');<br />
$this-&gt;view-&gt;theme = $settings['theme_dir'];</p>
<p>Currently, I keep that code in init() method of every controller. Is there any better solution, maybe with those action helpers?</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob...</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-24603</link>
		<dc:creator>Rob...</dc:creator>
		<pubDate>Sun, 22 Mar 2009 19:18:33 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-24603</guid>
		<description>Mo,

Return $this from the function MyViewHelperName::myViewHelperName()

Regards,

Rob...</description>
		<content:encoded><![CDATA[<p>Mo,</p>
<p>Return $this from the function MyViewHelperName::myViewHelperName()</p>
<p>Regards,</p>
<p>Rob...</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mo</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-24602</link>
		<dc:creator>Mo</dc:creator>
		<pubDate>Sun, 22 Mar 2009 17:57:38 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-24602</guid>
		<description>Hi, 
 am facing a small problem; am trying to create a view helper with more than just one method. 

for one method it works perfectly, i just call it from the view using $this-&gt;MyViewHelperName();

but, i created another method in the class and when i try to call it.. it fails
$this-&gt;MyViewHelperName()-&gt;MethodTwo();

Any idea how can i make it work?
Thanks,</description>
		<content:encoded><![CDATA[<p>Hi,<br />
 am facing a small problem; am trying to create a view helper with more than just one method. </p>
<p>for one method it works perfectly, i just call it from the view using $this-&gt;MyViewHelperName();</p>
<p>but, i created another method in the class and when i try to call it.. it fails<br />
$this-&gt;MyViewHelperName()-&gt;MethodTwo();</p>
<p>Any idea how can i make it work?<br />
Thanks,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Dunn</title>
		<link>http://akrabat.com/zend-framework/using-action-helpers-in-zend-framework/#comment-23918</link>
		<dc:creator>Jonathan Dunn</dc:creator>
		<pubDate>Fri, 16 Jan 2009 09:26:18 +0000</pubDate>
		<guid isPermaLink="false">http://akrabat.com/?p=271#comment-23918</guid>
		<description>ok that makes sense, thanks rob!

Jonno.</description>
		<content:encoded><![CDATA[<p>ok that makes sense, thanks rob!</p>
<p>Jonno.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
