-- John Wiklund <[EMAIL PROTECTED]> wrote
(on Wednesday, 23 May 2007, 05:32 AM -0700):
> I am using multiple modules on one page where each module is dispatched and
> rendered independently of each other (the same module could be dispatch
> several times on one page).
>
> Is there any ZF methods for creating/getting module namespace's? This would
> be good for avoiding name collision for element id, form names, js functions
> etc.
>
> i.e.
>
> <form name="<?php echo $this->getNamespace(); ?>my_form">
> <input id="<?php echo $this->getNamespace(); ?>input_id"/>
> </form>
You could always create a helper to do it:
class Zend_View_Helper_GetNamespace
{
public $front;
public function __construct()
{
$this->front = Zend_Controller_Front::getInstance();
}
public function getNamespace()
{
return $this->front->getRequest()->getModuleName();
}
}
Drop this in as a view helper, and you'd be able to use the notation you
display above.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/