<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dave Kelly :: Blog &#187; Zend Framework</title>
	<atom:link href="http://www.davidkelly.ie/category/zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidkelly.ie</link>
	<description>www.davidkelly.ie</description>
	<lastBuildDate>Tue, 06 Jul 2010 18:41:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Zend_Form Radio Buttons</title>
		<link>http://www.davidkelly.ie/2008/06/18/zend_form-radio-buttons/</link>
		<comments>http://www.davidkelly.ie/2008/06/18/zend_form-radio-buttons/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 15:58:27 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.davidkelly.ie/blog/?p=66</guid>
		<description><![CDATA[More on the ongoing struggle with the Zend Framework&#8217;s documentation&#8230;. After much trawling of the Zend Framework Manual, ZF on Nabble, and Google, I finally tracked down how to include &#38; manipulate radio buttons using Zend_Form (ZF 1.5). The HTML code I was trying to output was something along the lines of: &#60;input type="radio" value="1" [...]]]></description>
			<content:encoded><![CDATA[<p>More on the ongoing struggle with the Zend Framework&#8217;s documentation&#8230;.</p>
<p>After much trawling of the <a class="zem_slink" title="Zend Framework" rel="homepage" href="http://framework.zend.com/">Zend Framework</a> Manual, <a href="http://www.nabble.com/Zend-Framework-f15440.html">ZF on Nabble</a>, and Google, I finally tracked down how to include &amp; manipulate radio buttons using Zend_Form (ZF 1.5).</p>
<p>The HTML code I was trying to output was something along the lines of:</p>
<p><code>&lt;input type="radio" value="1" name="staff" /&gt; &lt;label&gt;Jim&lt;/label&gt; &lt;br/&gt;<br />
&lt;input type="radio" value="2" name="staff" /&gt; &lt;label&gt;John&lt;/label&gt;<br />
</code></p>
<p>Apparently, to do this the <code>setMultiOptions</code> needs to be used, although that this is required is not made clear in the <a href="http://framework.zend.com/manual/en/zend.form.html">Zend_Form Documentation</a>. To do it:<span id="more-66"></span></p>
<p><code>Zend_Loader::loadClass('Zend_Form');<br />
Zend_Loader::loadClass('Zend_Form_Element_Radio');</code><code><br />
$form = new Zend_Form;</code></p>
<p><code>$staffname = array('Jim', 'John');<br />
$staff = new Zend_Form_Element_Radio('staff');<br />
$staff-&gt;setRequired(true)  // field required<br />
-&gt;setValue('R')  // first radio button selected<br />
-&gt;setMultiOptions($staffname);  // add array of values / labels for radio group<br />
$form-&gt;addElement($staff);</code></p>
<p>However, I also needed to specify the <code>value</code> attribute of each of the radio buttons. To set this value, the key value of the array being passed into <code>setMultiOptions</code> is used. So, for example,<br />
<code><br />
$options = StaffTable::getStaff();  // get staff details from StaffTable<br />
$staffname = array();<br />
foreach($options as $st){<br />
$staffname[$st['staff_id']] = $st['staff_name']; // set staff_id as the key<br />
}</code></p>
<p>This is retrieving a recordset of staff id&#8217;s and staff names for use in the radio button group. It uses the value of staff_id for the key value of the $staffname array.  This will then be used as the value in the radio buttons. So if this $staffname array is passed into setMultiOptions, the output is: (note: the staff_id values for Jim and John were 32 and 28 respectively)</p>
<p><code><br />
&lt;label style="white-space: nowrap;"&gt;&lt;input name="staff" type="radio" value="32" /&gt;Jim&lt;/label&gt;<br />
&lt;label style="white-space: nowrap;"&gt;&lt;input name="staff" type="radio" value="28" /&gt;John&lt;/label&gt;<br />
</code><br />
During all my searching, it seems that there&#8217;s an acknowledgement (but some frustration) that the documentation for certain parts of the framework (such as Zend_Form) is lacking in both detail and useful examples. That said, I&#8217;ve been finding it pretty useful despite the learning curve and the occasionally long bouts of searching the web to solve problems&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidkelly.ie/2008/06/18/zend_form-radio-buttons/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Installing Apache alongside IIS for Zend PHP Framework</title>
		<link>http://www.davidkelly.ie/2008/01/14/installing-apache-alongside-iis-for-zend-php-framework/</link>
		<comments>http://www.davidkelly.ie/2008/01/14/installing-apache-alongside-iis-for-zend-php-framework/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 23:18:03 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://www.davidkelly.ie/blog/2008/01/14/installing-apache-alongside-iis-for-zend-php-framework/</guid>
		<description><![CDATA[After deciding to experiment with the Zend PHP Framework for web application development, I needed to install Apache on a local machine for development. I’m a novice when it comes to Web Server configuration / installation, but after reading the installation would take 15-20 minutes, I started feeling pretty dumb after a few hours of [...]]]></description>
			<content:encoded><![CDATA[<p>After deciding to experiment with the <a href="http://framework.zend.com/">Zend PHP Framework</a> for web application development, I needed to install <a href="http://httpd.apache.org/">Apache</a> on a local machine for development. I’m a novice when it comes to Web Server configuration / installation, but after reading the installation would take 15-20 minutes, I started feeling pretty dumb after a few hours of searching Google and still getting either nothing at all, or error messages.<br />
<span id="more-6"></span><br />
The setup I had before the installation was XP Professional, with IIS already installed.  Also there were PHP5 and MySQL 5.0.41</p>
<p>To try and save you a few hours you’ll never get back, here’s how I managed to get Apache / PHP / Zend up and running:</p>
<ol>
<li>Download the Apache installer (the .msi file)</li>
<li>Install Apache using the installer and fill in the options you need</li>
<li>Modify the httpd.conf file as follows:
<ol>
<li>To get it to work with IIS you need to change the port to something other than 80 (which is the one IIS listens to by default).  To do this you can search for <code>Listen</code>, and change the line to:<br />
<code>Listen 8080</code> (This means that the web root document on the Apache server is accessed through http://127.0.0.1:8080).</li>
<li>Search for <code>rewrite_module</code> and uncomment the line:<br />
<code>LoadModule rewrite_module modules/mod_rewrite.so</code><br />
(This module is used by the Zend Framework to rewrite URLs)</li>
<li>At the end of the <code>LoadModule</code> statements, add the line:<br />
<code>LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"</code></li>
<li>Search for <code>DirectoryIndex</code> and change it to:<br />
<code>DirectoryIndex index.html index.html.var index.php</code></li>
<li>At the end of the AddType statements, add in the lines:<br />
<code>AddType application/x-httpd-php .php</code> <code>AddType application/x-httpd-php .phtml</code></li>
</ol>
</li>
</ol>
<p>It was around here that I ran into problems….</p>
<p>It seems obvious now (!), but even though you have PHP installed for IIS, it won’t work on Apache unless you reinstall the parts you need (&#8230;as I said, a novice).  When I originally installed PHP, I downloaded a .msi file (php-5.2.3-win32-installer.msi) – so go back to where that&#8217;s saved, double click on it,  and select “Next”, then “Change” and you see four collapsible lists.</p>
<p>From here, go into “Extensions” and select “PDO” (PHP Data Objects Support &#8211; which Zend uses)&#8230; that was figured out after some time searching for an error that said: “Uncaught exception &#8216;Zend_Db_Adapter_Exception&#8217; with message &#8216;The PDO extension is required for this adapter but the extension is not loaded&#8217;.</p>
<p>Under the “Web Server Setup” list choose the Apache Version that you need (I had the most recent version, so I selected “Apache 2.2.x”).</p>
<p>I found that when viewing the site in Firefox, I got a “Cannot Connect to Server” when trying to view PHP files or sub-directories before the installation was set up correctly.  You can also use the &#8220;Start Apache in Console&#8221; command in the Start Menu (Start &gt;&gt; All Programs &gt;&gt; Apache HTTP Server &gt;&gt; Control Apache &gt;&gt; Start Apache in Console) to see if there are errors; if there aren&#8217;t, you&#8217;ll get a blank screen, otherwise the error will be displayed.</p>
<p>After this, it was just a matter of following the Zend Framework installation instructions, and it was up and running…</p>
<p>Some tutorials that saved me even more time doing this were:<br />
<a href="http://tanguay.info/web/tutorial.php?idCode=phpDevelopment">http://tanguay.info/web/tutorial.php?idCode=phpDevelopment</a></p>
<p>If there are any updates to the configuration as I experiment with Zend, I&#8217;ll add them in here, or drop them into a new post&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidkelly.ie/2008/01/14/installing-apache-alongside-iis-for-zend-php-framework/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
