Posts tagged with: html

Adding HTML Tags to a Zend Form Element

For the purposes of styling I had the need to put an opening <div> at the beginning of one element, and a closing </div> tag at the end of another. The Zend Framework guides don’t do a great job of detailing this.

On the element you want to add the opening div tag you would do the following:
[code=”php”]
$open_element->addDecorator(array(
array(‘openDiv’ =>’HtmlTag’),
array(‘tag’ => ‘div’, ‘openOnly’ => true)
));
[/code]

On the element you want to add the closing div tag:
[code=”php”]
$close_element->addDecorator(array(
array(‘closeDiv’ =>’HtmlTag’),
array(‘tag’ => ‘div’, ‘closeOnly’ => true)
));
[/code]


CSS and JavaScript File Versioning to Force Refreshing of Your User’s Cache

When you push updates to your site or web app, you may notice issues with users’ cache still holding onto the old version of CSS and JavaScript files. An easy way to force a reload of the files is to call them with a version number in the request like so:
[code=”html”]

[/code]

When you update the version of the file it will force the file to reload. This is very handy because you can extend the length of time of the cache on the user’s end or the server and force a reload when an update occurs without any special tricks.