This can easily be done using decorators. For instance using the Description decorator. It is important to note though that you will need to turn off escaping for the output of the decorator:
array('Description', array('escape', false)),
array('HtmlTag', array('tag' => 'dd')),
array('Label', array('tag' => 'dt')),
Now, you can use the following to add extra HTML to the element:
$element->setDescription('<strong>This contains HTML that will actually be parsed by the browser, not escaped</strong>');
The file element needs a special file decorator, which is added by default. When you set your own decorators for file elements, you delete the default decorators. For example:
You should use a File decorator instead of the ViewHelper for the file element, like so:
The receive() method will return true for file elements that are not required. The reason is that you said "the file can be omitted, and that's ok for me". The receive() method will return false only in the event of a failure.
Still there are several ways to detect if a file has been uploaded or not:
Use isUploaded which returns a boolean
Use getFileName which returns null in this case (note that you must use the latest release for this behaviour)
Use getFileInfo which will have an empty 'file' key and the flag 'isUploaded' set to false
Zend Framework requires PHP 5.2.4 and up. Some Zend Framework components may work with earlier versions of PHP, but these components are tested and supported only on 5.2.4 and up. See the requirements appendix for more information.
No. Zend Framework was built to use all of the sophisticated object oriented features of PHP 5 and take advantage of significant performance and security enhancements.
Another consideration was support of the platform ZF would be running on. The PHP community officially discontinued support for PHP 4 as of 2008-01-01, and no critical security updates will be published for PHP 4 after 2008-08-08.
These factors, among others, convinced us that PHP 5 was the best platform for Zend Framework and applications built on ZF.