List Info

Thread: Custom view helper and auto detecting directory




Custom view helper and auto detecting directory
country flaguser name
United Kingdom
2008-05-08 06:47:02
Hi,
 
This is probably more of a PHP than ZF question, but I am hoping some can help
 
I have a custom view helper class for widgets that live outside the MVC structure i.e.
 
htdocs
  application
    controllers
    models
    views
    ...
  library
    Magik
      View
        Helper
          WidgetMessage.php
      View.php
    ...
   widgets
     MyWidget
       MyWidget.php
       MyWidget.phtml
       
 
<code&gt;
class Magik_View extends Zend_View
{
 &nbsp;  public function __construct($path = null)
 &nbsp;  {
 &nbsp; &nbsp; &nbsp;  $this->;addHelperPath('library' . DS . 'Magik' . DS . 'View' . DS . 'Helper' , 'Magik_View_Helper'
);

 &nbsp; &nbsp; &nbsp;  $this->setScriptPath($path);
 &nbsp;  }

}
</code&gt;

As you can see in the above code I have to pass a path when I call the class within my file MyWidget.php e.g.

$view = new Magik_View(dirname(__FILE__));

What I would like to be able to do is just use:

$view = new Magik_View();

So, my question is, is there anyway for my custom view helpler to be able to automatically detect the directory that MyWidget.php is living in?

Thanks in advance,

- Robert


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )