<?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>Zero7Web</title>
	<atom:link href="http://blog.zero7web.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.zero7web.com</link>
	<description>Web Design and Development</description>
	<lastBuildDate>Wed, 10 Mar 2010 10:59:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Unveils Virtual Panoramas of Ski Runs At The 2010 Winter Olympic Games</title>
		<link>http://blog.zero7web.com/2010/02/google-unveils-virtual-panoramas-of-ski-runs-at-the-2010-winter-olympic-games/</link>
		<comments>http://blog.zero7web.com/2010/02/google-unveils-virtual-panoramas-of-ski-runs-at-the-2010-winter-olympic-games/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 12:29:10 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ski]]></category>
		<category><![CDATA[street view]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/2010/02/google-unveils-virtual-panoramas-of-ski-runs-at-the-2010-winter-olympic-games/</guid>
		<description><![CDATA[Google has added the Winter Olympics slopes to its Street View , allowing people to see the same view down a mountain as a skier about to push off in their quest for gold.

Engineer Dan Ratner explained: &#8220;In typical scrappy Google fashion, we were able to put this together over a few weekends. We used [...]]]></description>
			<content:encoded><![CDATA[<p>Google has added the Winter Olympics slopes to its Street View , allowing people to see the same view down a mountain as a skier about to push off in their quest for gold.</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/UJ4pgcrJU8c&#038;hl=en_GB&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/UJ4pgcrJU8c&#038;hl=en_GB&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>Engineer Dan Ratner explained: &#8220;In typical scrappy Google fashion, we were able to put this together over a few weekends. We used extra pieces from our Street View cars, some 2&#215;4s, some duct tape, and a lot of extra hard drives.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/02/google-unveils-virtual-panoramas-of-ski-runs-at-the-2010-winter-olympic-games/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: Allow hyphens in URL&#8217;s using ASP.NET MVC 2</title>
		<link>http://blog.zero7web.com/2010/02/how-to-allow-hyphens-in-urls-using-asp-net-mvc-2/</link>
		<comments>http://blog.zero7web.com/2010/02/how-to-allow-hyphens-in-urls-using-asp-net-mvc-2/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 14:28:03 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C-Sharp]]></category>
		<category><![CDATA[Hyphens]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MVC 2.0]]></category>
		<category><![CDATA[URL Routing]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=200</guid>
		<description><![CDATA[If you wan&#8217;t to allow hyphens in your URL&#8217;s you will need to change the way the routing works in your Global.asax file.
First create a new class which extends the MvcRouteHandler and place this in the Global.asax file after the main MvcApplication class.
C#:

public class HyphenatedRouteHandler : MvcRouteHandler&#123;
	protected override IHttpHandler  GetHttpHandler&#40;RequestContext requestContext&#41;
	&#123;
		requestContext.RouteData.Values&#91;&#34;controller&#34;&#93; = requestContext.RouteData.Values&#91;&#34;controller&#34;&#93;.ToString&#40;&#41;.Replace&#40;&#34;-&#34;, &#34;_&#34;&#41;;
		requestContext.RouteData.Values&#91;&#34;action&#34;&#93; [...]]]></description>
			<content:encoded><![CDATA[<p>If you wan&#8217;t to allow hyphens in your URL&#8217;s you will need to change the way the routing works in your Global.asax file.</p>
<p>First create a new class which extends the <strong>MvcRouteHandler</strong> and place this in the <strong>Global.asax</strong> file after the main <strong>MvcApplication</strong> class.</p>
<p>C#:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">public class HyphenatedRouteHandler <span style="color: #339933;">:</span> MvcRouteHandler<span style="color: #009900;">&#123;</span>
	protected override IHttpHandler  GetHttpHandler<span style="color: #009900;">&#40;</span>RequestContext requestContext<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		requestContext.<span style="color: #202020;">RouteData</span>.<span style="color: #202020;">Values</span><span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;controller&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> requestContext.<span style="color: #202020;">RouteData</span>.<span style="color: #202020;">Values</span><span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;controller&quot;</span><span style="color: #009900;">&#93;</span>.<span style="color: #202020;">ToString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #202020;">Replace</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		requestContext.<span style="color: #202020;">RouteData</span>.<span style="color: #202020;">Values</span><span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;action&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> requestContext.<span style="color: #202020;">RouteData</span>.<span style="color: #202020;">Values</span><span style="color: #009900;">&#91;</span><span style="color: #ff0000;">&quot;action&quot;</span><span style="color: #009900;">&#93;</span>.<span style="color: #202020;">ToString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #202020;">Replace</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> base.<span style="color: #202020;">GetHttpHandler</span><span style="color: #009900;">&#40;</span>requestContext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>VB:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Public</span> Class HyphenatedRouteHandler
    Inherits MvcRouteHandler
&nbsp;
    Protected Overrides <span style="color: #000080;">Function</span> GetHttpHandler(<span style="color: #000080;">ByVal</span> requestContext <span style="color: #000080;">As</span> System.Web.Routing.RequestContext) <span style="color: #000080;">As</span> System.Web.IHttpHandler
        requestContext.RouteData.Values(&quot;controller&quot;) = requestContext.RouteData.Values(&quot;controller&quot;).ToString.Replace(&quot;-&quot;, &quot;_&quot;)
        requestContext.RouteData.Values(&quot;action&quot;) = requestContext.RouteData.Values(&quot;action&quot;).ToString.Replace(&quot;-&quot;, &quot;_&quot;)
        Return MyBase.GetHttpHandler(requestContext)
    <span style="color: #000080;">End</span> <span style="color: #000080;">Function</span>
&nbsp;
<span style="color: #000080;">End</span> Class</pre></div></div>

<p>Then you need to replace the <strong>routes.MapRoute</strong> with an equivalent <strong>routes.Add</strong> specifying the new handler as the MapRoute does not allow you to specify a custom route handler.</p>
<p>C#:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">routes.<span style="color: #202020;">Add</span><span style="color: #009900;">&#40;</span>
	new Route<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;{controller}/{action}/{id}&quot;</span><span style="color: #339933;">,</span> 
		new RouteValueDictionary<span style="color: #009900;">&#40;</span>
			new <span style="color: #009900;">&#123;</span> controller <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Default&quot;</span><span style="color: #339933;">,</span> action <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Index&quot;</span><span style="color: #339933;">,</span> id <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			new HyphenatedRouteHandler<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>VB:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">routes.Add(<span style="color: #000080;">New</span> Route(&quot;{controller}/{action}/{id}&quot;, 
	<span style="color: #000080;">New</span> RouteValueDictionary(<span style="color: #000080;">New</span> <span style="color: #000080;">With</span> {.controller = &quot;Home&quot;, .action = &quot;Index&quot;, .id = &quot;&quot;}), 
		<span style="color: #000080;">New</span> HyphenatedRouteHandler()))</pre></div></div>

<p>I hope this is useful, any questions feel free to get in touch.</p>
<p>Would like to say thanks to John from <a href="http://stackoverflow.com/questions/2070890/asp-net-mvc-support-for-urls-with-hyphens">here</a> for answering the original question on <a href="http://stackoverflow.com">Stackoverflow</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/02/how-to-allow-hyphens-in-urls-using-asp-net-mvc-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC 2 RC 2 Released</title>
		<link>http://blog.zero7web.com/2010/02/asp-net-mvc-2-rc-2-released/</link>
		<comments>http://blog.zero7web.com/2010/02/asp-net-mvc-2-rc-2-released/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 10:02:52 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC 2.0 RC"]]></category>
		<category><![CDATA[Phil Haack]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=198</guid>
		<description><![CDATA[Today ASP.NET MVC 2 RC2 has been released.
To download it click here
It seems there are only a few changes to this release which you can find here: Release Notes
A few words from Phil Haack&#8217;s blog:
The biggest change in this release was described by Brad Wilson in his blog post on Input Validation vs. Model Validation [...]]]></description>
			<content:encoded><![CDATA[<p>Today ASP.NET MVC 2 RC2 has been released.</p>
<p>To download it <a href="http://go.microsoft.com/fwlink/?LinkID=182483">click here</a></p>
<p>It seems there are only a few changes to this release which you can find here: <a href="http://go.microsoft.com/fwlink/?LinkID=182482">Release Notes</a></p>
<p>A few words from Phil Haack&#8217;s blog:</p>
<blockquote><p>The biggest change in this release was described by Brad Wilson in his blog post on <a href="http://bradwilson.typepad.com/blog/2010/01/input-validation-vs-model-validation-in-aspnet-mvc.html">Input Validation vs. Model Validation in ASP.NET MVC</a>. Also included in this release are an assortment of bug fixes and performance improvements.</p>
<p>The window to provide feedback on this release is going to be very short as we are closing in on the RTM. If you want to provide input into this release, please do take the bits for a spin as soon as possible. I’m pretty excited about this release as I can see the end of the tunnel fast approaching. <img src='http://blog.zero7web.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>At this point, we’ll only be taking recall class bugs for ASP.NET MVC 2. All other bug reports will be filed against ASP.NET MVC 3. Sometime in the near future, I’ll start sharing some of our planning around that. How exciting!</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/02/asp-net-mvc-2-rc-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook launch HipHop, a sourcecode-converter from php to c++</title>
		<link>http://blog.zero7web.com/2010/02/facebook-launch-hiphop-a-sourcecode-converter-from-php-to-c/</link>
		<comments>http://blog.zero7web.com/2010/02/facebook-launch-hiphop-a-sourcecode-converter-from-php-to-c/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 12:00:14 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[hiphop]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=186</guid>
		<description><![CDATA[Yesterday Facebook launched HipHop, a converter from php to c++ so your apps can run twice as fast due to them being compiled not interpreted.
Today I&#8217;m excited to share the project a small team of amazing people and I have been working on for the past two years; HipHop for PHP. With HipHop we&#8217;ve reduced [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday Facebook launched HipHop, a converter from php to c++ so your apps can run twice as fast due to them being compiled not interpreted.</p>
<blockquote><p>Today I&#8217;m excited to share the project a small team of amazing people and I have been working on for the past two years; HipHop for PHP. With HipHop we&#8217;ve reduced the CPU usage on our Web servers on average by about fifty percent, depending on the page. Less CPU means fewer servers, which means less overhead. This project has had a tremendous impact on Facebook. We feel the Web at large can benefit from HipHop, so we are releasing it as open source this evening in hope that it brings a new focus toward scaling large complex websites with PHP. While HipHop has shown us incredible results, it&#8217;s certainly not complete and you should be comfortable with beta software before trying it out. &#8211; <a href="http://developers.facebook.com/news.php?blog=1&#038;story=358">Haiping Zhao (Facebook)</a></p></blockquote>
<p>HipHop is for scaling large multiserver high traffic sites like Facebook. In your regular application, you will get no great advantage from it. It is definately something to be aware of but it does make you think if your trying to compile PHP using a tool like this why not develop in C# (<a href="http://www.asp.net/mvc/">ASP.NET MVC 2 maybe?</a>) that is compiled anyway?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/02/facebook-launch-hiphop-a-sourcecode-converter-from-php-to-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: Use JQuery &#8211; The Basics</title>
		<link>http://blog.zero7web.com/2010/01/tutorial-how-to-jquery-basics/</link>
		<comments>http://blog.zero7web.com/2010/01/tutorial-how-to-jquery-basics/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 00:04:33 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=162</guid>
		<description><![CDATA[JQuery Basics
This post will show you some of the basics of JQuery. It is not an in depth tutorial but will give you some pointers to get you started with JQuery.
OK, the first piece of code you need to use JQuery is a link to the JQuery JS library. First, download the latest JQuery Library [...]]]></description>
			<content:encoded><![CDATA[<p><strong>JQuery Basics</strong><br />
This post will show you some of the basics of JQuery. It is not an in depth tutorial but will give you some pointers to get you started with JQuery.<br />
OK, the first piece of code you need to use JQuery is a link to the JQuery JS library. First, download the latest JQuery Library from the following link&#8230;.<br />
http://docs.jquery.com/Downloading_jQuery<br />
Then link to it like any other javascript file (like so)&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./js/jquery-1.4.1.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Obviously choosing the correct path for your version web server file system setup.<br />
The next step after linking the JQuery library is to use it! Look at the following piece of code.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./js/jquery-1.4.1.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
		$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// here is some code</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>This is essentially the same as calling a standard Javascript Window.OnLoad event handler, except it&#8217;s the JQuery way.<br />
We are saying&#8230; when the document is ready (loaded) run some code.<br />
This is your basic first step to using JQuery. You can also use other event handlers to launch your code, or even call the functions directly, but often when using JQuery, especially for styling/design features, you will want to run the code and so this is the easiest way.<br />
At the moment this code is not very useful, as it doesn&#8217;t do anything, so let’s add a little more.<br />
Let’s create a very basic html page.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;JQuery Basics&lt;/title&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;a id=&quot;link1&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 1&lt;/a&gt;
		&lt;a id=&quot;link2&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 2&lt;/a&gt;
		&lt;a id=&quot;link3&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 3&lt;/a&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>Ok now let’s add some JQuery&#8230;.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;JQuery Basics&lt;/title&gt;
		&lt;script src=&quot;./js/jquery-1.4.1.js&quot;&gt;&lt;/script&gt;
		&lt;script&gt;
			$(document).ready(function() {
				$('a').click(function() {
					alert(&quot;This is JQuery in action!&quot;);
				});
			});
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;a id=&quot;link1&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 1&lt;/a&gt;
		&lt;a id=&quot;link2&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 2&lt;/a&gt;
		&lt;a id=&quot;link3&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 3&lt;/a&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>Now save the file and open it in a web browser. When you click a link you should find you get a popup.<br />
Let’s examine this code a little further.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;This is JQuery in action!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The first part</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p> is a selector, the same as in CSS. Here we are saying apply to all of the A (anchor) tags in the document.<br />
Next we’re saying</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>This means for all of those A tags use the click event handler.<br />
Finally we’re saying when that click event is found on an A tag</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;This is JQuery in action!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p> This generates the popup.<br />
In this example we chose to use</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a'</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p> as our selector, but there are many other ways we can select elements.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#link1'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p> This is the same as the getElementByID function that is commonly used in JavaScript. Here we are selecting the element with the ID “link1”.<br />
We could also use</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.myLink'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>to select all elements with the class name “myLink”.</p>
<p>In our examples we have used the click event handler to launch the code when the link is clicked. We don’t have to add an event handler here if we don’t want to.<br />
Let’s look at another example.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;JQuery Basics&lt;/title&gt;
		&lt;script src=&quot;./js/jquery-1.4.1.js&quot;&gt;&lt;/script&gt;
		&lt;script&gt;
			$(document).ready(function() {
				$('a').addClass(&quot;red&quot;);
			});
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;a id=&quot;link1&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 1&lt;/a&gt;
		&lt;a id=&quot;link2&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 2&lt;/a&gt;
		&lt;a id=&quot;link3&quot; class=&quot;myLink&quot; href=&quot;#&quot;&gt;Link 3&lt;/a&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>This sets all A tags in documents to have the class “red”.<br />
This is a basic class which is built into the JQuery library, but you could just as easily add your own class.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;JQuery Basics&lt;/title&gt;
		&lt;script src=&quot;./js/jquery-1.4.1.js&quot;&gt;&lt;/script&gt;
		&lt;script&gt;
			$(document).ready(function() {
				$('a').addClass(&quot;myClass&quot;);
			});
		&lt;/script&gt;
		&lt;style&gt;
			.myClass {
				color:blue;
				text-decoration:underline;
			}
		&lt;/style&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;a id=&quot;link1&quot; href=&quot;#&quot;&gt;Link 1&lt;/a&gt;
		&lt;a id=&quot;link2&quot; href=&quot;#&quot;&gt;Link 2&lt;/a&gt;
		&lt;a id=&quot;link3&quot; href=&quot;#&quot;&gt;Link 3&lt;/a&gt;
	&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>You could also use first, last, parent and child selectors just like in CSS. For example</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a:first'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myClass&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>to select the first of the link tags and apply the class “myClass” just to that first link.</p>
<p>These are just a few very basic examples of how you can start using JQuery, look out for more posts in the future where we will show you some of the many other exciting features of JQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/01/tutorial-how-to-jquery-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>30,000 Niche Market Articles at Your Fingertips to use as you please (plus e-book creation tool)</title>
		<link>http://blog.zero7web.com/2010/01/30000-niche-market-articles-at-your-fingertips-to-use-as-you-please-plus-e-book-creation-tool/</link>
		<comments>http://blog.zero7web.com/2010/01/30000-niche-market-articles-at-your-fingertips-to-use-as-you-please-plus-e-book-creation-tool/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 12:48:41 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[affiliate]]></category>
		<category><![CDATA[articles]]></category>
		<category><![CDATA[clickbank]]></category>
		<category><![CDATA[ebooks]]></category>
		<category><![CDATA[making money]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[micro niche]]></category>
		<category><![CDATA[niche]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=158</guid>
		<description><![CDATA[I found this on another blog and thought it would be very useful for a lot of the readers:
Original Blog Link
I thought this would be of interest to you all. It&#8217;s a piece of software you can get your hands on that gives you access to 30,000 Niche articles that you can use as you [...]]]></description>
			<content:encoded><![CDATA[<p>I found this on another blog and thought it would be very useful for a lot of the readers:<br />
<a href="http://n.otes.co.uk/articles/30k-niche-market-articles-at-your-fingertips/">Original Blog Link</a></p>
<blockquote><p>I thought this would be of interest to you all. It&#8217;s a piece of software you can get your hands on that gives you access to 30,000 Niche articles that you can use as you please. Place them on your blog to generate traffic or give them away as freebies to attract people towards your chargeable products.</p>
<p>You can use these articles to help create backlinks to your sites and you can even create One-of-a-Kind eBooks with the Built in eBook Creation Wizard. Bonus!</p>
<p>There&#8217;s a free video you can watch that shows how it works and just how easy it is to get going. The time you will save by having a massive library of articles is going to be insane!</p>
<p>This is highly recommended by us and we would like to hear your success stories, because there will be a lot of them! I have bought into this package myself and I can honest say I am very glad as I not how content to post on all of my other website to bring in the visitors.</p>
<p><a href="http://ac673widxv42ok2amouhicqe-y.hop.clickbank.net/" target="_top" style="font-size:1.4em;">Visit the site now to watch your free video explaining more&#8230;</a></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/01/30000-niche-market-articles-at-your-fingertips-to-use-as-you-please-plus-e-book-creation-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Andi Gibson Photography Website Online</title>
		<link>http://blog.zero7web.com/2010/01/andi-gibson-photography-website-online/</link>
		<comments>http://blog.zero7web.com/2010/01/andi-gibson-photography-website-online/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 13:44:08 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=154</guid>
		<description><![CDATA[Andi Gibson&#8217;s Photography site is now online. The simple design was requested to create a nice sleek look. The site is sat on top of a wordpress blog and will be updated regularly with portfolio and company information.

Visit website
]]></description>
			<content:encoded><![CDATA[<p>Andi Gibson&#8217;s Photography site is now online. The simple design was requested to create a nice sleek look. The site is sat on top of a wordpress blog and will be updated regularly with portfolio and company information.</p>
<p><a href="http://www.andigibson.co.uk"><div class="wp-caption aligncenter" style="width: 510px"><img alt="Andi Gibson Photography screenshot" src="http://www.zero7web.com/images/portfolio/website-andigibson.jpg" title="Andi Gibson Photography" width="500" height="100" /><p class="wp-caption-text">Andi Gibson Photography screenshot</p></div></a></p>
<p><a href="http://www.andigibson.co.uk">Visit website</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/01/andi-gibson-photography-website-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>210 Dental Clinic Website Complete</title>
		<link>http://blog.zero7web.com/2010/01/210-dental-clinic-website-complete/</link>
		<comments>http://blog.zero7web.com/2010/01/210-dental-clinic-website-complete/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 13:17:15 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[210 dental clinic]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=150</guid>
		<description><![CDATA[The 210 Dental Clinic is now online. The site has been developed over the past few months and the client is very happy with the end result.

210 Dental Clinic Website
]]></description>
			<content:encoded><![CDATA[<p>The 210 Dental Clinic is now online. The site has been developed over the past few months and the client is very happy with the end result.</p>
<p><a href="http://www.210dentalclinic.com"><div class="wp-caption aligncenter" style="width: 510px"><img title="Screenshot" src="http://www.zero7web.com/images/portfolio/website-210.png" alt="210 Dental Clinic screen shot" width="500" height="100" /><p class="wp-caption-text">210 Dental Clinic screen shot</p></div></a></p>
<p><a href="http://www.210dentalclinic.com">210 Dental Clinic Website</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2010/01/210-dental-clinic-website-complete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are RSS and Atom Feeds and how do I create them?</title>
		<link>http://blog.zero7web.com/2009/11/what-are-rss-and-atom-feeds-and-how-do-i-create-them/</link>
		<comments>http://blog.zero7web.com/2009/11/what-are-rss-and-atom-feeds-and-how-do-i-create-them/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 21:36:38 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[rss2.0]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://blog.zero7web.com/?p=131</guid>
		<description><![CDATA[What are feeds?
Really Simple Syndication (RSS) and Atom feeds are different formats used to publish updates or changes such as new blog entries, news entries or user activity in a standard format. The feed is basically an XML document containing certain information about the updated content.
What information do they contain?
The “feed”, “web feed” or “channel” [...]]]></description>
			<content:encoded><![CDATA[<h2>What are feeds?</h2>
<p>Really Simple Syndication (RSS) and Atom feeds are different formats used to publish updates or changes such as new blog entries, news entries or user activity in a standard format. The feed is basically an XML document containing certain information about the updated content.</p>
<h2>What information do they contain?</h2>
<p>The “feed”, “web feed” or “channel”  includes full or summarised text, plus metadata such as published date, category and authorship.</p>
<h2>Should I use RSS or Atom?</h2>
<p>RSS is more widely used as it was around first although the Atom feed standards seen to have a better structure I personally would stick with RSS 2.0 as it will work on all readers and software, and people are familiar with the term RSS.</p>
<h2>Why should I use a feed on my website?</h2>
<p>Web feeds make it easy to inform people of changes to your website. Anyone interested in your feed can subscribe to it via an RSS reader which can then keep track of updates for you. You can use fees in outlook, through the browser or through many desktop applications available.</p>
<h2>How can I create a feed?</h2>
<p>I will talk you through a very basic example of a feed to get you started but if your interested in taking it further you should read the <a href="http://www.rssboard.org/rss-specification">RSS 2.0 specs</a> and also those for <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php">Atom feeds</a>.</p>
<p>You can either generate the feed manually or dynamically, but either way the end result will be structured the same.</p>
<p>Below is an example of a RSS document (XML).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rss</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Social Addict Feed<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>This shows the latest updates on socialaddict.co.uk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.socialaddict.co.uk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>HOUSJUNKI :: BOXING DAY :: 26.12.09 :: CLUB.V<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>http://www.socialaddict.co.uk/events/single-event?eID=91<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/link<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Event added: HOUSJUNKI :: BOXING DAY :: 26.12.09 :: CLUB.V @ Club Venus by andoi - Sat 21st Nov 2009 8:19pm<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>EVENT<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pubDate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Sat, 21 Nov 2009 20:19:40 +0000<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/pubDate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copyright<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>(c) Social Addict 2009<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copyright<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/channel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rss<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Creating a static feed</h2>
<p>Simply take the code you have produced like above and save it as an XML document, rss.xml will be fine and then upload to your website. You take give out a direct link to the feed or if you would like users of the website to pick up that it exists automatically then simply add the following code into the head area of the HTML code.</p>

<div class="wp_syntax"><div class="code"><pre class="xhtml" style="font-family:monospace;">&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;RSS Feed&quot; href=&quot;rss.xml&quot; /&gt;</pre></div></div>

<h2>Dynamically creating a feed using PHP</h2>
<p>If you have a dynamic (database driven) website then it would make more sense to dynamically generate the feed.</p>
<p>We have recently made a feed for a client site ( <a href="http://www.socialaddict.co.uk/rss">www.socialaddict.co.uk/rss</a> ) and we had to bring together the data from several different tables and merge them so the feed could take all updates into account. </p>
<p>We used the <a href="http://daniel.lorch.cc/projects/rss2writer/">RSS2Writer</a> class to generate the XML document which simplies the use of the PHP XMLWriter object. Grab yourself a copy of the class and you can use the example below to help get you started.</p>
<p>This is assuming you have a mySQL database with a table called &#8220;updates&#8221; and it contains:</p>
<p>`title`  VARCHAR<br />
`category` VARCHAR<br />
`info` VARCHAR<br />
`url` VARCHAR<br />
`created` DATETIME</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
try <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #666666; font-style: italic;">// Create RSS writer</span>
  <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'includes/RSS2Writer.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$rss</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> rss2writer<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Social Addict Feed'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'This shows the latest updates on    socialaddict.co.uk'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://www.socialaddict.co.uk'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Create Database connection</span>
    <span style="color: #000088;">$dbh</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PDO<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql:host=localhost;dbname=test'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'username, '</span>password<span style="color: #0000ff;">'); // put your database details in here
    // Get data and iterate through it
    foreach($dbh-&gt;query('</span>SELECT `title`<span style="color: #339933;">,</span>`category`<span style="color: #339933;">,</span>`info`<span style="color: #339933;">,</span>`url`<span style="color: #339933;">,</span>`created` from updates<span style="color: #0000ff;">') as $feed) {
&nbsp;
        // Get each feed item information
	$rss-&gt;addItem($feed['</span>title<span style="color: #0000ff;">'], $feed['</span>info<span style="color: #0000ff;">'], $feed['</span>url<span style="color: #0000ff;">'], true);
	$rss-&gt;addElement('</span>category<span style="color: #0000ff;">', $feed['</span>category<span style="color: #0000ff;">']);
	$rss-&gt;addElement('</span>pubDate<span style="color: #0000ff;">', date(&quot;r&quot;,strtotime($feed['</span>created<span style="color: #0000ff;">'])));
	$rss-&gt;addElement('</span>copyright<span style="color: #0000ff;">', '</span><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span> Social Addict <span style="color: #cc66cc;">2009</span><span style="color: #0000ff;">');
	$rss-&gt;closeItem();
&nbsp;
    }
    $dbh = null;
&nbsp;
    // Set header type to XML
    header('</span>Content<span style="color: #339933;">-</span>type<span style="color: #339933;">:</span> text<span style="color: #339933;">/</span>xml<span style="color: #0000ff;">');
&nbsp;
   //$rss-&gt;writeToFile('</span>rss<span style="color: #339933;">.</span>xml<span style="color: #0000ff;">'); //write the xml output to file (optional)
   echo $rss-&gt;getXML(); // Output XML to browser / screen
&nbsp;
// Catch any errors
} catch (PDOException $e) {
    print &quot;An error occured: &quot; . $e-&gt;getMessage() . &quot;&lt;br/&gt;&quot;;
    die();
}
?&gt;</span></pre></div></div>

<p>Any questions are welcome, and we also help people out where we can.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2009/11/what-are-rss-and-atom-feeds-and-how-do-i-create-them/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: Create a re-usable form with the Zend Framework with validation and filters</title>
		<link>http://blog.zero7web.com/2009/11/how-to-create-reusable-form-zend-framework-zend_form-validation-filters/</link>
		<comments>http://blog.zero7web.com/2009/11/how-to-create-reusable-form-zend-framework-zend_form-validation-filters/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 12:12:36 +0000</pubDate>
		<dc:creator>Zero7Web</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.zero7ict.com/?p=126</guid>
		<description><![CDATA[It is quite easy to start using a framework as an easy way to manage your url rewriting, and forget about all the added functionality provided by the framework. An ideal example of this is when making forms. You can create a form manually and that is perfectly valid, but if you use the framework [...]]]></description>
			<content:encoded><![CDATA[<p>It is quite easy to start using a framework as an easy way to manage your url rewriting, and forget about all the added functionality provided by the framework. An ideal example of this is when making forms. You can create a form manually and that is perfectly valid, but if you use the framework it will help you filter and validate the form with very little effort!</p>
<p><strong>Zend_Form</strong><br />
The framework provides a Zend_Form class that you can extend to easily create forms and assign validation and filters too with a few simple lines of code. Name the elements the same as the db then the populate will work with one line of code also.</p>
<p>In your Application folder create a Forms folder</p>
<p>This is an example form:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> Form_CreateEmail <span style="color: #000000; font-weight: bold;">extends</span> Zend_Form
<span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
        parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'createemail'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Form_Element_Text<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$title</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Subject'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRequired</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addFilter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'StripTags'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addFilter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'StringTrim'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">addValidator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'NotEmpty'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Form_Element_Textarea<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'info'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$info</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Email Content'</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttribs</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rows'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cols'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">79</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #000088;">$submit</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Form_Element_Submit<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$submit</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setAttrib</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'submitbutton'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addElements</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$info</span><span style="color: #339933;">,</span> <span style="color: #000088;">$submit</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>You can then call it from your controller like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Form_CreateEmail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">submit</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Add'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And display it from you view using</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>If you want this to be included on everypage you could create a new helper file</p>
<p>in your views folder create a helpers folder and create a myHelper.php file</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Zend_View_Helper_MyHelper
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> myHelper<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Form_CreateEmail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$form</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">submit</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setLabel</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Add'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$form</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This could be output from your layout using:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">MyHelper</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Hope this helps someone</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.zero7web.com/2009/11/how-to-create-reusable-form-zend-framework-zend_form-validation-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
