Here’s the fastest way to add a checkbox element with a label to the side of it (inline) using the Zend Framework. By default, the checkbox is put on a separate line after the label,which isn’t a standard practice. This can be done using some CSS and a Zend Decorator element.
CSS Code:
label.inline {
display: inline;
}
.inlinecheck{
clear: both;
float: left;
width: 25px;
margin-bottom: 0;
}
Zend PHP Code:
$this->addElement('checkbox', 'mycheckbox', array(
'label' => 'My Label',
'name' => 'mycheckbox',
));
$this->getElement('mycheckbox')->addDecorator('Label', array('placement' => 'APPEND'));
$this->getElement('mycheckbox')->addDecorator('HtmlTag', array('tag' => 'dl','class' => 'inlinecheck'));
Rename mycheckbox with the name of your element and set the label accordingly.