Inserting a text string or paragraph into Zend_Form

If you want to add text after element in form just use description of form element.

textElement = new Zend_Form_Element('someElement'); 
$textElement->setDescription('TEXT'); 

or in the form file:

        $this->addElement(
            'text',
            'some element',
            array(
                'label'         => 'Some element:',
                'description'   => 'TEXT',
            )
        );

If you are wanting something more complex you must define your own decorator.

Posted in Php, Zend Framework at September 27th, 2012. No Comments.

How can I get the current module, controller and action in Zend Framework?

Today I will show you how to get current module, controller and action name in Zend Framework. In the default routing, both the module, controller and the action are always passed along with the request. And the code to retrieve them is very simple:

$moduleName = $this->getRequest()->getModuleName();
$controllerName = $this->getRequest()->getControllerName();
$actionName = $this->getRequest()->getActionName();

And that’s all. Good luck.

Posted in Php, Zend Framework at July 27th, 2011. No Comments.