I recently decided to start using MAMP again and this time I found myself looking at the ability to specify the version of PHP to use as a real plus. I am actually using MAMP Pro, so it may be a feature of that but since they are stored in the MAMP folder structure I assume that is a feature of MAMP itself and not restricted to the Pro version.
I have seen questions about how to get the form tag in a view for the form that is being used as an alternative to rendering the whole form.
I had a project a while back that I did not want to render the form but wanted to just render each element individually so that the designer could manage the CSS and general structure of the HTML. This was not a real problem in that it is rather easy to render each element on its own using
&amp;lt;?php echo $this-&amp;gt;form-&amp;gt;elementName-&amp;gt;render(); ?&amp;gt;
for each of the elements. With ZF1, doing the view this way tends to lead to people entering the opening and closing form tags manually like so
&amp;lt;form action=&amp;quot;/controllerName/actionName&amp;quot; method=&amp;quot;post&amp;quot;&amp;gt; &amp;lt;?php echo $this-&amp;gt;form-&amp;gt;elementName-&amp;gt;render(); ?&amp;gt; &amp;lt;/form&amp;gt;
which means they lose out on the OOP factor of that part of Zend_Form.
I recently had the opportunity to work on a piece of code that was to accept a couple of values based on a couple of drop-down selectors. The second of the selectors needed to be relative to the value selected in the first one. This was part of a project that uses the Zend Framework. In order to not compromise my NDA, I am changing the particulars, but the nature of the task remains true. To that end, I will start by setting the environment. As stated, I am using the Zend Framework and implementing the MVC design pattern that ZF is known for. I am using the Zend_Layout extension and have the standard application/layouts/scripts folder with a “layout.phtml” file containing my overall layout. I am using just the Controller/Action setup rather than the Module/Controller/Action one, so if you are utilizing modules, then you will need to adjust this to your environment. I also use Zend_Form to create my form input and you will see some example code based on this a little later that will show two drop-down selectors defined on a form. The first drop-down selector will be called Category and the second drop-down selector will be called SubCategory. I know, how original! So, now that the background is laid out, lets start by defining the solution I am setting out to accomplish here.