
Photo from http://www.flickr.com/photos/daniello/
Summary
Here I discuss the creation of a view helper for modifying HTML tags, and more specifically body tags. The created view helper allows functionality similar to the head*/inlineScript view helpers already in the standard Zend Framework view helpers, but allows the programmatic modification of tag attributes. Definitely check out the demo page and the code on github.
Motivation
The standard Zend Framework view helpers are a great set of tools for streamlining mundane view tasks and allowing for the modification/addition of scripts and header blocks (generally held in the layout) from within the view without applying ugly hacks (i.e. the head*/inlineScript view helpers).
Upon occasion I have found need to make modifications to the <body> tag, for example adding an onload, class, or style attribute etc. I also required to be able to perform this from within other view helpers. Take this following contrived example…
On website X, certain pages include standard dojo forms. These dojo forms are held within view helpers for convenience. Generally it has been decided not to include the dojo CSS classes in the body tag and only add them when necessary. There maybe several view helpers on the page that need to add their own attributes to the body tag. (I said it was contrived)
The code is available in my GIT repository @ github and the demo page.
Continue reading 'Zend Framework Body Tag View Helper'»
PHP, Web Programming, Zend Framework, Zend_Registry, Zend_View_Helper
|
Body, framework, helper, html, PHP, view, view helper, zend, Zend Framework, Zend_Registry, Zend_View_Helper, Zend_View_Helper_Placeholder_Container_Standalone
In this article I look at using Zend_Layout and Zend_View along with a simple front controller to show how it is possible to start separating business logic and presentation within your application. All code is available on github:
Naked Zend_Layout and Zend_View on GitHub.
Articles, PHP, Web Programming, Zend Framework, Zend_Layout, Zend_View
|
application, framework, helper, PHP, view helper, zend, Zend Framework, zend_layout, zend_view
As a follow up to my previous post on per module based layout settings for Zend Framework, I’ve updated the code to require less configuration then before (not that it required more that a few lines in your application configuration!).
Continue reading 'Zend Framework Per Module Layout Settings – Follow Up'»
Articles, Computing, PHP, Web Programming, Zend Framework
|
action, controller, framework, helper, layout, module, PHP, zend, Zend Framework
This may seem simple, but I was banging my head trying to create a URL in a custom view helper in Zend Framework. I have routing setup which gets the module from the sub-domain in use so I couldn’t use a simple hardcoded URL.
Continue reading 'Creating URL in Zend Custom View Helper'»
Articles, PHP, Web Programming, Zend Framework, Zend_View, Zend_View_Helper
|
custom, framework, front controller, helper, PHP, Router, view, zend, Zend Framework, Zend_View_Helper_Abstract