<?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>The Tutorial Blog &#187; jQuery</title>
	<atom:link href="http://www.thetutorialblog.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetutorialblog.com</link>
	<description></description>
	<lastBuildDate>Tue, 08 Nov 2011 19:21:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<image>
<link>http://www.thetutorialblog.com</link>
<url>http://www.thetutorialblog.com/wp-content/plugins/maxblogpress-favicon/icons/favicon-28.ico</url>
<title>The Tutorial Blog</title>
</image>
		<item>
		<title>Weekly Recap (14 Feb &#8211; 21 Feb)</title>
		<link>http://www.thetutorialblog.com/general/weekly-recap-14-feb-21-feb/</link>
		<comments>http://www.thetutorialblog.com/general/weekly-recap-14-feb-21-feb/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 15:41:57 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[objective-c]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[weekly recap]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=295</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Here is a recap of the posts from this week. Build a Twitter-like site with CodeIgniter and jQuery Part 2 5 PHP Frameworks you may not know about Creating a basic iPad application No related posts. Related posts brought to you by Yet Another Related Posts Plugin.


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fgeneral%2Fweekly-recap-14-feb-21-feb%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fgeneral%2Fweekly-recap-14-feb-21-feb%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Weekly Recap (14 Feb   21 Feb)" alt=" Weekly Recap (14 Feb   21 Feb)" /><br />
			</a>
		</div>
<p>Here is a recap of the posts from this week.</p>
<h2><a href="http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/">Build a Twitter-like site with CodeIgniter and jQuery Part 2</a></h2>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/cijqt.jpg" alt="CodeIngiter + jQuery=twitter" title="CodeIngiter + jQuery=twitter" width="471" height="211" class="alignleft size-full wp-image-257" /></p>
<h2><a href="http://www.thetutorialblog.com/php/5-php-frameworks-you-may-not-know-about/">5 PHP Frameworks you may not know about</a></h2>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/php_logo.jpg" alt="php logo Weekly Recap (14 Feb   21 Feb)" title="php_logo" width="328" height="230" class="alignleft size-full wp-image-280" /></p>
<h2><a href="http://www.thetutorialblog.com/cocoa-objective-c/creating-a-basic-ipad-application/">Creating a basic iPad application</a></h2>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/ipad.jpg" alt="ipad Weekly Recap (14 Feb   21 Feb)" title="ipad" width="450" height="338" class="alignleft size-full wp-image-292" /></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/general/weekly-recap-14-feb-21-feb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build a Twitter-like site with CodeIgniter and jQuery Part 2</title>
		<link>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/</link>
		<comments>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 19:58:15 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[build a social network]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[code igniter]]></category>
		<category><![CDATA[codeigniter series]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[how to build a social network]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[jquery series]]></category>
		<category><![CDATA[jquery tutorial]]></category>
		<category><![CDATA[php series]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[the tutorial blog]]></category>
		<category><![CDATA[twitter series]]></category>
		<category><![CDATA[twitter tutorial]]></category>
		<category><![CDATA[twitter-like tutorial]]></category>
		<category><![CDATA[wez pyke]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=268</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Don't forget to check out part 1 if you have no read it. In the second part of this 5 part tutorial series on how to build a Twitter-like website, we will be creating a signup form so that users can register to our website. We will be adding records to the database that we [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery-part-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery-part-2%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Build a Twitter like site with CodeIgniter and jQuery Part 2" alt=" Build a Twitter like site with CodeIgniter and jQuery Part 2" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/cijqt.jpg" alt="CodeIngiter + jQuery=twitter" title="CodeIngiter + jQuery=twitter" width="471" height="211" class="alignleft size-full wp-image-257" /><br />
Don't forget to check out <a href="http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/">part 1</a> if you have no read it.</p>
<p>In the second part of this 5 part tutorial series on how to build a Twitter-like website, we will be creating a signup form so that users can register to our website.</p>
<p>We will be adding records to the database that we created in part 1 and creating validation rules to make sure that the user didn't put any invalid data into the form.<br />
<span id="more-268"></span></p>
<h2>Change the base url</h2>
<p>Navigate to <em>ci_twitter->system->applications->config->config.php</em>.<br />
Change:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://example.com/&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To the path to where CodeIgniter is. On my machine it would be:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://tutorials:8888/ci_twitter/&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Create the controller</h2>
<p>We need to create a main controller for things such as the home page, sign up page, login page, etc. Go to <em>ci_twitter->system->application->controllers</em> then in the controllers folder create a file called main.php.</p>
<p>Inside our main controller we now need to define the class and the functions inside it.</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>
<span style="color: #000000; font-weight: bold;">class</span> main <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> signup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</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;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</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;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> signin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</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;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</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;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signin'</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>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If we were to go to <em>http://localhost/ci_twitter/index.php/main/</em> then we will see a blank page.</p>
<h2>Create the views</h2>
<p>Before we can see anything we need to create a folder for the functions in our main controller. Go to <em>ci_twitter->system->application->views</em>. Inside the views folder create another folder called main. In the main folder we will create files for each function that we have in the main controller.</p>
<p>Create these files in the main folder we created:</p>
<ul>
<li>index.php</li>
<li>signup.php</li>
<li>signup_success.php</li>
<li>signin.php</li>
</ul>
<p>Go to index.php and enter Hello World. Now if you go to <em>http://localhost/ci_twitter/index.php/main/</em> you will see Hello World.</p>
<p>The next thing to do is to add a form and text fields so that people can input data. For the sign up page the html is done in the signup.php view file. The validation and processing is done in the main controller inside the signup function.</p>
<p>Add the following code to the signup.php view:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h2&gt;Sign up&lt;/h2&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> validation_errors<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> form_open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
Full name: &lt;input type=&quot;text&quot; name=&quot;name&quot; /&gt; &lt;br /&gt;
Username: &lt;input type=&quot;text&quot; name=&quot;username&quot; /&gt; &lt;br /&gt;
Password: &lt;input type=&quot;password&quot; name=&quot;password&quot; /&gt; &lt;br /&gt;
Email: &lt;input type=&quot;text&quot; name=&quot;email&quot; /&gt; &lt;br /&gt;
&lt;input type=&quot;submit&quot; value=&quot;Create my account&quot; name=&quot;create&quot; /&gt;
&nbsp;
&lt;/form&gt;</pre></div></div>

<p>Then add this inside signup_success.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Your account was created, <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> anchor<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'login here'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This is all that we need to do for the sign up view for now. Validation rules is what we will do next in the main controller for sign up.</p>
<h2>Validation</h2>
<p>When doing form validation all of the validation takes place inside of the controller. For now we will set basic validation rules for each field within the form.</p>
<p>In the main controller replace the code for the signup function with:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> signup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</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;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</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;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|trim|xss_clean'</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;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Username'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|trim|xss_clean'</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;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Password'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|trim|xss_clean'</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;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Email'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required|min_length[5]|max_length[50]|valid_email'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup_success'</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></pre></div></div>

<p>If you go to the sign up page now you should see that all the validation code works like it should. Now we will add a model so that we can add the user to the users table.</p>
<h2>Create user model</h2>
<p>Go to the model folder and create a file called User_model.php.</p>
<p>Insert this code into the model:</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>
<span style="color: #000000; font-weight: bold;">class</span> User_model <span style="color: #000000; font-weight: bold;">extends</span> Model <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> user_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</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;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">from</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users'</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;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_username'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">count_all_results</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> create_user<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fullname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user_fullname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$fullname</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_username'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_email'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_password'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$password</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;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Now we need to load the User_model in the controller.<br />
Insert this code in the signup function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">model</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'User_model'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We also need to add the user if the validation rules are passed:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">User_model</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create_user</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</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;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'username'</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;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'email'</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;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</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;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main/signup_success'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Part 3</h2>
<p>In part 3 we will be creating a login page and functionality so that people can post messages.</p>
<h2>Download</h2>
<p><a href="http://bit.ly/c7ycMW">Download</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery-part-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Posts from this week</title>
		<link>http://www.thetutorialblog.com/general/posts-from-this-week/</link>
		<comments>http://www.thetutorialblog.com/general/posts-from-this-week/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 01:21:13 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=264</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Here is a list of posts from this week if you may have missed anything. 20 Stunning Wallpapers For Your Desktop 10 Awesome jQuery Tutorials You Should Check Out 10 Flash and Actionscript Tutorials for the Beginner Cheat sheets: jQuery, MooTools, Prototype Deep Linking with jQuery Build a Twitter-like site with CodeIgniter and jQuery No [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fgeneral%2Fposts-from-this-week%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fgeneral%2Fposts-from-this-week%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Posts from this week" alt=" Posts from this week" /><br />
			</a>
		</div>
<p>Here is a list of posts from this week if you may have missed anything.</p>
<h2><a href="http://www.thetutorialblog.com/general/20-stunning-wallpapers-for-your-desktop/">20 Stunning Wallpapers For Your Desktop</a></h2>
<p><a href="http://www.thetutorialblog.com/general/20-stunning-wallpapers-for-your-desktop/"><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/17.jpg" alt="17 Posts from this week" title="17" width="650" height="406" class="alignleft size-full wp-image-202" /></a></p>
<h2><a href="http://www.thetutorialblog.com/jquery/10-awesome-jquery-tutorials-you-should-check-out/">10 Awesome jQuery Tutorials You Should Check Out</a></h2>
<p><a href="http://www.thetutorialblog.com/jquery/10-awesome-jquery-tutorials-you-should-check-out/"><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/jquery-logo.gif" alt="jquery logo Posts from this week" title="jquery-logo" width="320" height="220" class="alignleft size-full wp-image-224" /></a></p>
<h2><a href="http://www.thetutorialblog.com/flash-actionscript/10-flash-and-actionscript-tutorials-for-the-beginner/">10 Flash and Actionscript Tutorials for the Beginner</a></h2>
<p><a href="http://www.thetutorialblog.com/flash-actionscript/10-flash-and-actionscript-tutorials-for-the-beginner/"><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/4_adobe-flash-9-logo-1-full.png" alt="4 adobe flash 9 logo 1 full Posts from this week" title="4_adobe-flash-9-logo-1-full.png" width="250" height="250" class="alignleft size-full wp-image-231" /></a></p>
<h2><a href="http://www.thetutorialblog.com/general/cheat-sheets-jquery-mootools-prototype/"><br />
Cheat sheets: jQuery, MooTools, Prototype</a></h2>
<p><a href="http://www.thetutorialblog.com/general/cheat-sheets-jquery-mootools-prototype/"><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/jquerymootoolsprototype.jpg" alt="jquerymootoolsprototype Posts from this week" title="jquery-mootools-prototype" width="635" height="111" class="alignleft size-full wp-image-238" /></a></p>
<h2><a href="http://www.thetutorialblog.com/jquery/deep-linking-with-jquery/">Deep Linking with jQuery</a></h2>
<p><a href="http://www.thetutorialblog.com/jquery/deep-linking-with-jquery/"><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/Screen-shot-2010-02-10-at-14.52.00.png" alt="jQuery" title="jQuery" width="263" height="79" class="alignleft size-full wp-image-251" /></a></p>
<h2><a href="http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/">Build a Twitter-like site with CodeIgniter and jQuery</a></h2>
<p><a href="http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/"><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/cijqt.jpg" alt="CodeIngiter + jQuery=twitter" title="CodeIngiter + jQuery=twitter" width="471" height="211" class="alignleft size-full wp-image-257" /></a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/general/posts-from-this-week/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Build a Twitter-like site with CodeIgniter and jQuery</title>
		<link>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/</link>
		<comments>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 15:39:07 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[build a social network]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[code igniter]]></category>
		<category><![CDATA[codeigniter series]]></category>
		<category><![CDATA[codeigniter tutorial]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[how to build a social network]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[jquery series]]></category>
		<category><![CDATA[jquery tutorial]]></category>
		<category><![CDATA[php series]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[the tutorial blog]]></category>
		<category><![CDATA[twitter series]]></category>
		<category><![CDATA[twitter tutorial]]></category>
		<category><![CDATA[twitter-like tutorial]]></category>
		<category><![CDATA[wez pyke]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=256</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	This tutorial will be the first of a five part series where we will built a social network site similar to Twitter from scratch. We will be using the CodeIgniter framework for the core of the website and jQuery for the effects. In this first part we will be configuring CodeIgniter to display everything correctly [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fbuild-a-twitter-like-site-with-codeigniter-and-jquery%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Build a Twitter like site with CodeIgniter and jQuery" alt=" Build a Twitter like site with CodeIgniter and jQuery" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/cijqt.jpg" alt="CodeIngiter + jQuery=twitter" title="CodeIngiter + jQuery=twitter" width="471" height="211" class="alignleft size-full wp-image-257" /></p>
<p>This tutorial will be the first of a five part series where we will built a social network site similar to <a href="http://www.twitter.com">Twitter</a> from scratch. We will be using the <a href="http://www.codeigniter.com">CodeIgniter</a> framework for the core of the website and <a href="http://www.jquery.com">jQuery</a> for the effects. In this first part we will be configuring CodeIgniter to display everything correctly and we will also set up a database and connect to it.</p>
<p><span id="more-256"></span></p>
<h2>Download and configure</h2>
<p>Download the <a href="http://www.codeigniter.com">CodeIgniter</a> framework from their website. We don't need to download anything for jQuery because we will be loading it directly from Google as it's quicker to load.</p>
<p>Once you have downloaded the latest version of CodeIgniter from their website, unzip it and copy the files to your public_html folder or equivalent. Rename the CodeIgniter folder to ci_twitter.</p>
<p>Now if you go to http://localhost/ci_twitter you should see something similar to the image below.<br />
<img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/ci.jpg" alt="ci Build a Twitter like site with CodeIgniter and jQuery" title="ci" width="650" height="458" class="alignleft size-full wp-image-261" /></p>
<h2>Database</h2>
<p>We now need configure a database to connect to CodeIgniter so that we can use it to insert and retrieve information. Go to phpMyAdmin or whatever you use for MySQL databases. Create a database called ci_twitter.</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> <span style="color: #008000;">`ci<span style="color: #008080; font-weight: bold;">_</span>twitter`</span> <span style="color: #000033;">;</span></pre></div></div>

<p>For now we are only going to create a table for the users, in another part we will create other tables when we need them.</p>
<p><strong>users table</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"> <span style="color: #990099; font-weight: bold;">CREATE</span> <span style="color: #990099; font-weight: bold;">TABLE</span> <span style="color: #008000;">`ci<span style="color: #008080; font-weight: bold;">_</span>twitter`</span>.<span style="color: #008000;">`users`</span> <span style="color: #FF00FF;">&#40;</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>id`</span> <span style="color: #999900; font-weight: bold;">INT</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #FF9900; font-weight: bold;">AUTO_INCREMENT</span> <span style="color: #990099; font-weight: bold;">PRIMARY KEY</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>fullname`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">50</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>username`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">50</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>email`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">50</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>password`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">50</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>protected<span style="color: #008080; font-weight: bold;">_</span>updates`</span> <span style="color: #999900; font-weight: bold;">TINYINT</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #990099; font-weight: bold;">DEFAULT</span> <span style="color: #008000;">'0'</span><span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>location`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">50</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>web`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">50</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span> <span style="color: #000033;">,</span>
<span style="color: #008000;">`user<span style="color: #008080; font-weight: bold;">_</span>bio`</span> <span style="color: #999900; font-weight: bold;">VARCHAR</span><span style="color: #FF00FF;">&#40;</span> <span style="color: #008080;">160</span> <span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099; font-weight: bold;">NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span>
<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">ENGINE</span> <span style="color: #CC0099;">=</span> MYISAM</pre></div></div>

<h2>Configure CodeIgniter</h2>
<p>Now that we have set up our database and have inserted a table we will configure CodeIgniter to connect to it.</p>
<p>Navigate to database.php by going to <em>ci_twitter -> system -> application -> config -> database.php</em>. From here enter the correct information for your database so that it connects.</p>
<p>We need to auto load the database library because we will be using it a lot.</p>
<p>Go to <em>autoload.php</em> in the same folder as <em>database.php</em>.</p>
<p>Change:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$autoload</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'libraries'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'database'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The database library will now load every time without us having to put $this->load->library('database'); in every controller.</p>
<h2>End of Part 1</h2>
<p>This is the end of the first part of approximately five parts.</p>
<h2>Part 2</h2>
<p>Part 2 will be following tomorrow. In part 2 we will be creating a sign up so that we can add users to the database.</p>
<h2>Download</h2>
<p>You can download part one from <a href="http://bit.ly/91HSQ0">here</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/php/build-a-twitter-like-site-with-codeigniter-and-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Deep Linking with jQuery</title>
		<link>http://www.thetutorialblog.com/jquery/deep-linking-with-jquery/</link>
		<comments>http://www.thetutorialblog.com/jquery/deep-linking-with-jquery/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 14:43:43 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[deep linking]]></category>
		<category><![CDATA[deep linking tutorial]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery help]]></category>
		<category><![CDATA[jquery tutorial]]></category>
		<category><![CDATA[the tutorial blog]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[wez pyke]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=243</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	You can view a demo and download the resources for this tutorial at the bottom of the post. Web 2.0 websites have a lot of Ajax functionality, some times when you load a new element of a page you may want the user to be able to click the back or forward button so that [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fjquery%2Fdeep-linking-with-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fjquery%2Fdeep-linking-with-jquery%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Deep Linking with jQuery" alt=" Deep Linking with jQuery" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/Screen-shot-2010-02-10-at-14.52.00.png" alt="jQuery" title="jQuery" width="263" height="79" class="alignleft size-full wp-image-251" /></p>
<p><em>You can view a demo and download the resources for this tutorial at the bottom of the post.</em></p>
<p>Web 2.0 websites have a lot of Ajax functionality, some times when you load a new element of a page you may want the user to be able to click the back or forward button so that they can see the previously loaded content. One method to add this function to a website is to use the <a href="http://www.asual.com/jquery/address/">jQuery Address</a> plugin with jQuery. </p>
<p><a href="http://www.asual.com/jquery/address/">jQuery Addres</a>s has 4 main <a href="http://www.asual.com/jquery/address/docs/">methods</a>; <strong>init</strong>, <strong>change</strong>, <strong>internalChange</strong>, <strong>externalChange</strong>. The <strong>init</strong> method is what is called when the plugin is initiated. The <strong>change</strong> method is called when the URL is changed, an element in the page is changed or either the forward or backward button is pressed. The change method has the combined functionality of <strong>internalChange</strong> and <strong>externalChange</strong>. The <strong>internalChange</strong> is only called when a hyperlink inside the page is clicked; <strong>externalChange</strong> is only called when the URL is changed or the backward or forward button is pressed. </p>
<p>To allow deep linking within your website the only two methods that are required is <strong>init</strong> and <strong>change</strong>, you can then use <strong>internalChange</strong> and <strong>externalChange</strong> wherever you may need them. <br />
<span id="more-243"></span></p>
<h2>Getting it to work</h2>
<p>The first thing that is required of course is that you download the file for <a href="http://www.asual.com/jquery/address/">jQuery Address</a>. When you have done this copy the <em>jquery.address-1.1.min.js</em> file into the same location as your index.html file. </p>
<p>Now we include jQuery and the jQuery Address plugin, put this inside the head tags in your html file:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
google.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;1.4.1&quot;</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>
&lt;script src=&quot;jquery.address-1.1.min.js&quot;&gt;&lt;/script&gt;</pre></div></div>

<h2>The jQuery</h2>
<p>The next thing that we're going to do is create a function that will be called when a hyperlink is clicked so that we know what file to load and where to load it. We will call this function <strong>loadURL()</strong>, it will take one parameter named url.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> loadURL<span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    	console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loadURL: &quot;</span> <span style="color: #339933;">+</span> url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#area&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>We have console.log so that when we open up Firebug in Firefox we know which page is being requested. This is useful for debugging if there are any faults with the requested page loading. </p>
<p>We now set the jQuery Address event handlers so we know when to deep link an element within the page.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">address</span>.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	        console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;init: &quot;</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'[rel=address:'</span> <span style="color: #339933;">+</span> event.<span style="color: #660066;">value</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</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: #660066;">change</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#area&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'[rel=address:'</span> <span style="color: #339933;">+</span> event.<span style="color: #660066;">value</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;change&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></pre></div></div>

<p>What this code does is retrieves the href attribute from a hyperlink by matching the rel to a hyperlink. We also log when it should have changed so we can see this in Firebug.</p>
<p>The last bit of jQuery that we do will check when a link has been pressed and then call the <strong>loadURL()</strong> function that we created before.</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>
	    	loadURL<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</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>This is what the head of your file should look like:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
	&lt;title&gt;TheTutorialBlog.com : jQuery Deep Linking&lt;/title&gt;
	&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
	<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	google.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;1.4.1&quot;</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>
	&lt;script src=&quot;jquery.address-1.1.min.js&quot;&gt;&lt;/script&gt;
&nbsp;
&nbsp;
	<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #009966; font-style: italic;">/*&lt;![CDATA[*/</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;document&quot;</span><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>
&nbsp;
	    <span style="color: #003366; font-weight: bold;">function</span> loadURL<span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    	console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loadURL: &quot;</span> <span style="color: #339933;">+</span> url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#area&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	    <span style="color: #006600; font-style: italic;">// Event handlers</span>
	    $.<span style="color: #660066;">address</span>.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	        console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;init: &quot;</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'[rel=address:'</span> <span style="color: #339933;">+</span> event.<span style="color: #660066;">value</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</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: #660066;">change</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#area&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'[rel=address:'</span> <span style="color: #339933;">+</span> event.<span style="color: #660066;">value</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">']'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;change&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>
&nbsp;
	    $<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>
	    	loadURL<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</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>
&nbsp;
	    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009966; font-style: italic;">/*]]&gt;*/</span>
	<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/head&gt;</pre></div></div>

<h2>The HTML</h2>
<p>The HTML for this is really basic stuff, we will create two hyperlinks that will load two separate files. We will also create a div element named area, this is where the files will be loaded.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;body&gt;
&nbsp;
&nbsp;
	&lt;a href=&quot;test1.html&quot; rel=&quot;address:/test1&quot;&gt;Test 1&lt;/a&gt; &lt;br /&gt;
	&lt;a href=&quot;test2.html&quot; rel=&quot;address:/test2&quot;&gt;Test 2&lt;/a&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;
&nbsp;
	Load Area: &lt;br /&gt;
	&lt;div id=&quot;area&quot;&gt;&lt;/div&gt;
&nbsp;
&nbsp;
&lt;/body&gt;</pre></div></div>

<p>The name of the file that you want to load goes inside the <strong>href</strong> tag. You also need to include <em>address:/</em> inside <strong>rel</strong>. This is how jQuery Address knows what hyperlinks you want to deep link.</p>
<h2>Final words</h2>
<p>I hope this tutorial has been useful, please feel free to leave a comment or ReTweet this tutorial on Twitter.</p>
<h2>Demo and Download</h2>
<p><a href="http://bit.ly/aU5vcT">Demo</a><br />
<a href="http://bit.ly/c95Qwa">Download</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/jquery/deep-linking-with-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Cheat sheets: jQuery, MooTools, Prototype</title>
		<link>http://www.thetutorialblog.com/general/cheat-sheets-jquery-mootools-prototype/</link>
		<comments>http://www.thetutorialblog.com/general/cheat-sheets-jquery-mootools-prototype/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 14:57:33 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[cheat sheets]]></category>
		<category><![CDATA[jquery cheat sheet]]></category>
		<category><![CDATA[mootools cheat sheet]]></category>
		<category><![CDATA[prototype cheat sheet]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=237</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Javascript frameworks like jQuery, MooTools and Prototype are being used by almost all developers in web design and web development, and if you're not using them you should be. Frameworks like these make building complex Javascript functionality into websites a breeze with only a few lines of code. If you want to start using a [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fgeneral%2Fcheat-sheets-jquery-mootools-prototype%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fgeneral%2Fcheat-sheets-jquery-mootools-prototype%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Cheat sheets: jQuery, MooTools, Prototype" alt=" Cheat sheets: jQuery, MooTools, Prototype" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/jquerymootoolsprototype.jpg" alt="jquery-mootools-prototype" title="jquery-mootools-prototype" width="635" height="111" class="alignleft size-full wp-image-238" /></p>
<p>Javascript frameworks like jQuery, MooTools and Prototype are being used by almost all developers in web design and web development, and if you're not using them you should be. Frameworks like these make building complex Javascript functionality into websites a breeze with only a few lines of code.</p>
<p>If you want to start using a framework but are not sure which one is for you then you are probably best starting off with jQuery as it is simple to understand yet powerful. You can also use frameworks together, check out my post <a href="http://www.thetutorialblog.com/text-tutorials/quick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library/">here</a>.</p>
<p>In this post you'll find cheat sheets that will be helpful to you as a reference when using one of these frameworks and you can't quite remember a function.</p>
<p><span id="more-237"></span></p>
<h2><a href="http://www.futurecolors.ru/jquery/">jQuery</a></h2>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/jquery-logo1.gif" alt="jquery logo1 Cheat sheets: jQuery, MooTools, Prototype" title="jquery-logo" width="320" height="220" class="alignleft size-full wp-image-239" /></p>
<h2><a href="http://mediavrog.net/blog/2008/06/11/mootools/mootools-12-cheat-sheet/">MooTools</a></h2>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/mootools.gif" alt="mootools Cheat sheets: jQuery, MooTools, Prototype" title="mootools" width="180" height="60" class="alignleft size-full wp-image-240" /></p>
<h2><a href="http://www.prototypejs.org/2008/1/29/prototype-1-6-0-2-cheat-sheet">Prototype</a></h2>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/prototype.png" alt="prototype Cheat sheets: jQuery, MooTools, Prototype" title="prototype" width="188" height="102" class="alignleft size-full wp-image-241" /></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/general/cheat-sheets-jquery-mootools-prototype/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>10 Awesome jQuery Tutorials You Should Check Out</title>
		<link>http://www.thetutorialblog.com/jquery/10-awesome-jquery-tutorials-you-should-check-out/</link>
		<comments>http://www.thetutorialblog.com/jquery/10-awesome-jquery-tutorials-you-should-check-out/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 14:02:53 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[codeingiter]]></category>
		<category><![CDATA[digg-style]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[jquery suggestions]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[scrolling menu]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=222</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	jQuery is a great tool that everyone in web development should be using to make the functionality of their websites better, it's easy of use and good documentation is what makes jQuery such a successful framework. Although the documentation is good there are still a lot of tutorials out there that you should check out. [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fjquery%2F10-awesome-jquery-tutorials-you-should-check-out%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fjquery%2F10-awesome-jquery-tutorials-you-should-check-out%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="10 Awesome jQuery Tutorials You Should Check Out" alt=" 10 Awesome jQuery Tutorials You Should Check Out" /><br />
			</a>
		</div>
<p><img class="alignleft size-full wp-image-224" title="jquery-logo" src="http://www.thetutorialblog.com/wp-content/uploads/2010/02/jquery-logo.gif" alt="jquery logo 10 Awesome jQuery Tutorials You Should Check Out" width="320" height="220" /></p>
<p>jQuery is a great tool that everyone in web development should be using to make the functionality of their websites better, it's easy of use and good documentation is what makes jQuery such a successful framework. Although the documentation is good there are still a lot of tutorials out there that you should check out.</p>
<p><span id="more-222"></span></p>
<ol>
<li>
<h2><a href="http://www.thetutorialblog.com/text-tutorials/quick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library/">Quick Tip: Resolving conflicting problems between jQuery and MooTools or any other Javascript library</a></h2>
</li>
<li>
<h2><a href="http://www.thetutorialblog.com/php/twitter-like-pagination-using-codeigniter-and-jquery/">Twitter-like pagination using CodeIgniter and jQuery</a></h2>
</li>
<li>
<h2><a href="http://www.thetutorialblog.com/php/php-gallery-with-no-page-reloads-using-jquery/">PHP gallery with no page reloads using jQuery</a></h2>
</li>
<li>
<h2><a href="http://www.thetutorialblog.com/jquery/jquery-dropdown-suggestions/">jQuery Dropdown Suggestions</a></h2>
</li>
<li>
<h2><a href="http://www.thetutorialblog.com/php/twitter-like-pagination-using-cakephp-and-jquery/">Twitter-like pagination using CakePHP and jQuery</a></h2>
</li>
<li>
<h2><a href="http://valums.com/scroll-menu-jquery/">Create a Scrolling Menu with CSS and jQuery</a></h2>
</li>
<li>
<h2><a href="http://marcgrabanski.com/article/jquery-google-maps-tutorial-basics">jQuery and Google Maps Tutorial</a></h2>
</li>
<li>
<h2><a href="http://net.tutsplus.com/tutorials/javascript-ajax/inettuts/">How to Mimic the iGoogle Interface</a></h2>
</li>
<li>
<h2><a href="http://jqueryfordesigners.com/jquery-infinite-carousel/">jQuery Infinite Carousel</a></h2>
</li>
<li>
<h2><a href="http://www.queness.com/post/309/create-a-digg-style-post-sharing-tool-with-jquery">Create a Digg-style post sharing tool with jQuery</a></h2>
</li>
</ol>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/jquery/10-awesome-jquery-tutorials-you-should-check-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Dropdown Suggestions</title>
		<link>http://www.thetutorialblog.com/jquery/jquery-dropdown-suggestions/</link>
		<comments>http://www.thetutorialblog.com/jquery/jquery-dropdown-suggestions/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 21:36:24 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[dropdown box]]></category>
		<category><![CDATA[dropdown list]]></category>
		<category><![CDATA[dropdown menu]]></category>
		<category><![CDATA[suggestions]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=181</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	For this tutorial we are going to create a drop down box similar to the one on the Google homepage when you start typing. The Markup The first thing that we must do is create the markup HTML. We are also going to include a stylesheet called style.css, we will create the CSS further down [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fjquery%2Fjquery-dropdown-suggestions%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fjquery%2Fjquery-dropdown-suggestions%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="jQuery Dropdown Suggestions" alt=" jQuery Dropdown Suggestions" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2010/01/jquerydropdownsuggestions.jpg" alt="jquery dropdown suggestions" title="jquery dropdown suggestions" width="300" height="300" class="alignleft size-full wp-image-182" />For this tutorial we are going to create a drop down box similar to the one on the <a href="http://www.google.com">Google</a> homepage when you start typing.</p>
<h2>The Markup</h2>
<p>The first thing that we must do is create the markup HTML. We are also going to include a stylesheet called style.css, we will create the CSS further down the tutorial.<br />
<span id="more-181"></span><br />
We need to create an input field and a DIV element, the DIV element is where the suggestions will be displayed.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
	&lt;title&gt;TheTutorialBlog.com - jQuery Dropdown Suggestions&lt;/title&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;input type=&quot;text&quot; name=&quot;suggestions&quot; class=&quot;suggestionsinput&quot; value=&quot;Search&quot; /&gt;
	&lt;div id=&quot;suggestions&quot;&gt;
		Suggestions for &lt;span class=&quot;searchterm&quot;&gt;&lt;/span&gt;...
	&lt;/div&gt;&lt;!--suggestions--&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<h2>The CSS</h2>
<p>Create a file called style.css in the same folder.</p>
<p>We are going to give the input field and suggestions DIV rounded corners of 5 pixels. We will also hide the suggestions DIV because it should only be visible when a user starts to type.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">	body <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #6666ff;">.suggestionsinput</span> <span style="color: #00AA00;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">36px</span><span style="color: #00AA00;">;</span>
		-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
		-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#suggestions</span> <span style="color: #00AA00;">&#123;</span>
		-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
		-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">460px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
		<span style="color: #000000; font-weight: bold;">visibility</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
	<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h2>The jQuery</h2>
<p>Load the jQuery library from Google. Place this code below the include of the CSS file in your HTML file.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
	<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	google.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;1.3.2&quot;</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>Below this code we will write our jQuery.</p>
<p>Check that the document is loaded.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><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>
&nbsp;
		<span style="color: #006600; font-style: italic;">// Code goes here</span>
&nbsp;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>When the page is loaded the input field will display "Search", when the user clicks on the input field we want it to be blank so that they can start searching without having to delete the word.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	<span style="color: #006600; font-style: italic;">// clear text from input</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</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; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;Search&quot;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>When the input field has been cleared the user will begin typing, we need to check to see if the user has started typing and if they have then we need to display the suggestions box.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	<span style="color: #006600; font-style: italic;">// check if key has been pressed</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// make suggestions visible</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visibility'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'visible'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.searchterm&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">// $(&quot;#suggestions&quot;).load('http://URL.to.load');</span>
&nbsp;
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// hide suggestions</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</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: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visibility'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'hidden'</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>
&nbsp;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>In this tutorial we are only making the drop down box visible, to load an actual list of suggestions uncomment <i>$("#suggestions").load('http://URL.to.load');</i> then specify a URL where your script is that will load your suggestions and return it to the user.</p>
<h2>The HTML File</h2>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">	&lt;!DOCTYPE html&gt;
	&lt;html lang=&quot;en&quot;&gt;
	&lt;head&gt;
		&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
		&lt;title&gt;TheTutorialBlog.com - jQuery Dropdown Suggestions&lt;/title&gt;
		&lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot; type=&quot;text/css&quot; /&gt;
		&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
		<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
		google.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;jquery&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;1.3.2&quot;</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>
&nbsp;
		<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><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>
&nbsp;
			<span style="color: #006600; font-style: italic;">// clear text from input</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</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; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;Search&quot;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
			<span style="color: #006600; font-style: italic;">// check if key has been pressed</span>
			$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #006600; font-style: italic;">// make suggestions visible</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visibility'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'visible'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.searchterm&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.suggestionsinput&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #006600; font-style: italic;">// $(&quot;#suggestions&quot;).load('http://URL.to.load');</span>
&nbsp;
				<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #006600; font-style: italic;">// hide suggestions</span>
					$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</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: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#suggestions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'visibility'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'hidden'</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>
&nbsp;
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
	&lt;/head&gt;
	&lt;body&gt;
		&lt;input type=&quot;text&quot; name=&quot;suggestions&quot; class=&quot;suggestionsinput&quot; value=&quot;Search&quot; /&gt;
		&lt;div id=&quot;suggestions&quot;&gt;
			Suggestions for &lt;span class=&quot;searchterm&quot;&gt;&lt;/span&gt;...
		&lt;/div&gt;&lt;!--suggestions--&gt;
	&lt;/body&gt;
	&lt;/html&gt;</pre></div></div>

<h2>The CSS File: style.css</h2>
<p>body {<br />
	background-color: #ccc;<br />
}</p>
<p>.suggestionsinput {<br />
	font-size: 36px;<br />
	-moz-border-radius: 5px;<br />
	-webkit-border-radius: 5px;<br />
	border: 1px solid #999;<br />
	color: #999;<br />
}</p>
<p>#suggestions {<br />
	-moz-border-radius: 5px;<br />
	-webkit-border-radius: 5px;<br />
	width: 460px;<br />
	background-color: #999;<br />
	position: fixed;<br />
	padding: 5px;<br />
	visibility: hidden;<br />
}<br />
</h2>
<h2>Download/Demo</h2>
<p><a href="http://bit.ly/9GyfKV">Download</a><br />
<a href="http://bit.ly/daBYdP">Demo</a></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/jquery/jquery-dropdown-suggestions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP gallery with no page reloads using jQuery</title>
		<link>http://www.thetutorialblog.com/php/php-gallery-with-no-page-reloads-using-jquery/</link>
		<comments>http://www.thetutorialblog.com/php/php-gallery-with-no-page-reloads-using-jquery/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 18:02:09 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[image gallery]]></category>
		<category><![CDATA[image gallery using ajax]]></category>
		<category><![CDATA[imgbrowz0r]]></category>
		<category><![CDATA[php image gallery]]></category>
		<category><![CDATA[prettyPhoto]]></category>
		<category><![CDATA[thetutorialblog]]></category>
		<category><![CDATA[wez pyke]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=173</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	For this tutorial we will be using the ImgBrowz0r class for the backend of the gallery, we will then write a jQuery script so that we can browse through the gallery created by ImgBrowz0r without no page reloads and a nice effect between page requests so the user knows the page has changed. We will [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fphp-gallery-with-no-page-reloads-using-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Fphp%2Fphp-gallery-with-no-page-reloads-using-jquery%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="PHP gallery with no page reloads using jQuery" alt=" PHP gallery with no page reloads using jQuery" /><br />
			</a>
		</div>
<p><img src="http://www.thetutorialblog.com/wp-content/uploads/2009/12/jquery_gallery.jpg" alt="jquery gallery PHP gallery with no page reloads using jQuery" title="jquery_gallery" width="300" height="300" class="alignleft size-full wp-image-174" />For this tutorial we will be using the <a href="http://61924.nl/projects/imgbrowz0r.html">ImgBrowz0r</a> class for the backend of the gallery, we will then write a jQuery script so that we can browse through the gallery created by ImgBrowz0r without no page reloads and a nice effect between page requests so the user knows the page has changed. We will also be using the <a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">prettyPhoto plugin</a> for jQuery to open up the actual images.</p>
<h2>Getting ImgBrowz0r and prettyPhoto to work</h2>
<p>The first thing I done was create a folder called jquery_gallery inside here is where all the files and folders are gonna be stored. I then created 4 folders inside jquery_gallery, the folders are called css, images, inc and js.</p>
<p>When you have downloaded the ImgBrowz0r class, copy the file into the inc folder.<br />
<span id="more-173"></span><br />
Now inside the images folder create 2 folders cache and gallery. After you have unzipped prettyPhoto goto the images folder and inside the images folder copy the folder named prettyPhoto to our image folder. There should now be 3 folders inside our images folder cache, gallery and prettyPhoto.</p>
<p>Inside our css folder that we have created we will copy the css file from the prettyPhoto css folder named prettyPhoto.css.</p>
<p>The last thing to do for prettyPhoto is to copy the javascript file from the prettyPhoto js folder to our js folder.</p>
<p>So now we should have a file structure like so:<br />
|css<br />
|--prettyPhoto.css</p>
<p>|images<br />
|--cache<br />
|--gallery<br />
|--prettyPhoto</p>
<p>|inc<br />
|--imgbrowz0r.php</p>
<p>|js<br />
|--jquery.prettyPhoto.js</p>
<p>We need to also create a css file for our imgBrowz0r class, create a css file inside our css folder and name it gallery.css. Copy the code into this file that is below:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">strong <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* This is some example CSS. You can change this to your own liking. */</span>
	<span style="color: #6666ff;">.img-description</span><span style="color: #00AA00;">,</span> <span style="color: #6666ff;">.imgbrowz0r-navigation</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #933;">970px</span><span style="color: #00AA00;">;</span>text-align<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #6666ff;">.imgbrowz0r-navigation</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.5em</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">0.5em</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #6666ff;">.imgbrowz0r-navigation</span> <span style="color: #6666ff;">.img-statistics</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.5em</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #6666ff;">.img-description</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.5em</span> <span style="color: #993333;">auto</span> <span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-row</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">1em</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:link</span><span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Georgia<span style="color: #00AA00;">,</span> <span style="color: #ff0000;">&quot;Times New Roman&quot;</span><span style="color: #00AA00;">,</span> Times<span style="color: #00AA00;">,</span> <span style="color: #993333;">serif</span><span style="color: #00AA00;">;</span>text-decoration<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-thumbnail</span> a<span style="color: #3333ff;">:link </span>img<span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-thumbnail</span> a<span style="color: #3333ff;">:visited </span>img <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#000</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-thumbnail</span> a<span style="color: #3333ff;">:hover </span>img<span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-thumbnail</span> a<span style="color: #3333ff;">:active </span>img <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:link</span><span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.5em</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ccc</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> span.img-dir-name<span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> span<span style="color: #6666ff;">.img-thumb-date</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> span<span style="color: #6666ff;">.img-dir-name</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.2em</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-thumbnail</span> a<span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> .img-thumbnail<span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span> <span style="color: #933;">1.5em</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">25</span>%</span><span style="color: #00AA00;">;</span>text-align<span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span> <span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-column-1</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:link</span><span style="color: #00AA00;">,</span>
	<span style="color: #cc00cc;">#imgbrowz0r</span> <span style="color: #6666ff;">.img-directory</span> a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">160px</span><span style="color: #00AA00;">;</span>line-<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>
					       <span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>background-<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span> <span style="color: #933;"><span style="color: #cc66cc;">50</span>%</span> <span style="color: #00AA00;">&#125;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/* http://sonspring.com/journal/clearing-floats */</span>
	html body div.<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">,</span>
	html body span<span style="color: #6666ff;">.clear</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>clear<span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>display<span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>font-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>list-style<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
			       <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>overflow<span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>visibility<span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>height<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Create a file called index.php in the root of our folder and copy in the basic html.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
	&lt;title&gt;TheTutorialBlog.com | Photo Gallery&lt;/title&gt;
	&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	google.load(&quot;jquery&quot;, &quot;1.3.2&quot;);
	&lt;/script&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;css/prettyPhoto.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;no title&quot; charset=&quot;utf-8&quot;&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;css/gallery.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;no title&quot; charset=&quot;utf-8&quot;&gt;
	&lt;script src=&quot;js/jquery.prettyPhoto.js&quot;&gt;&lt;/script&gt;
&nbsp;
	&lt;script&gt;
		$(document).ready(function(){
		// prettyPhoto
			$(&quot;a[rel^='prettyPhoto']&quot;).prettyPhoto({
				showTitle: false
			});
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;content_main&quot;&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>Inside the div called content_main is where our the ImgBrowz0r class code will go.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'inc/imgbrowz0r.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// These are all settings (set to default). The settings are not validated since you have to configure everything.</span>
<span style="color: #666666; font-style: italic;">// There is a chance that ImgBrowz0r stops working if you enter the wrong values.</span>
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #666666; font-style: italic;">// Directory settings. These are required. Without trailing slash. (required)</span>
	<span style="color: #0000ff;">'images_dir'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'images/gallery'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cache_dir'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'images/cache'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Url settings. These are required. Without trailing slash. (required)</span>
	<span style="color: #666666; font-style: italic;">// %PATH% is replaced with the directory location and page number</span>
	<span style="color: #0000ff;">'main_url'</span>                 <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://localhost:8888/tutorials/jquery_gallery/index.php?q=%PATH%'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'images_url'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http:///localhost:8888/tutorials/jquery_gallery/images/gallery'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cache_url'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http:///localhost:8888/tutorials/jquery_gallery/images/cache'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Sorting settings (optional)</span>
	<span style="color: #0000ff;">'sort_by'</span>                  <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// 1 = filename, 2 = extension (png, gif, etc.), 3 = inode change time of file</span>
	<span style="color: #0000ff;">'sort_order'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// true = ascending, false = descending</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Thumbnail settings (optional)</span>
	<span style="color: #0000ff;">'thumbs_per_page'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Amount of thumbnails per page</span>
	<span style="color: #0000ff;">'max_thumb_row'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Amount of thumbnails on a row</span>
	<span style="color: #0000ff;">'max_thumb_width'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Maximum width of thumbnail</span>
	<span style="color: #0000ff;">'max_thumb_height'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Maximum height of thumbnail</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Time settings (optional)</span>
	<span style="color: #0000ff;">'time_format'</span>              <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Date formatting. Look at the PHP date() for help: http://nl3.php.net/manual/en/function.date.php</span>
	<span style="color: #0000ff;">'time_zone'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Timezone. Example: 1</span>
	<span style="color: #0000ff;">'enable_dst'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Daylight saving time (DST). Set this to true to enable it.</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Misc settings (optional)</span>
	<span style="color: #0000ff;">'ignore_port'</span>              <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Ignore port in url. Set this to true to ignore the port.</span>
	<span style="color: #0000ff;">'dir_thumbs'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Show a thumbnail in a category box. Default is false.</span>
	<span style="color: #0000ff;">'random_thumbs'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Use random thumbnails for categories. Default is false.</span>
	<span style="color: #0000ff;">'read_thumb_limit'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #666666; font-style: italic;">// See README for information about this setting.</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Start the class</span>
<span style="color: #000088;">$gallery</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> imgbrowz0r<span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Prepare everything. This function must be called before you call other functions.</span>
<span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Generate navigation and statistics</span>
<span style="color: #000088;">$gallery_breadcrumbs</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">breadcrumbs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$gallery_pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Display navigation</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;imgbrowz0r-navigation&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_breadcrumbs</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_pagination</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Display images and directories</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">browse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Display navigation</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;imgbrowz0r-navigation&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_pagination</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_breadcrumbs</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Fill in the information for the main_url, images_url and cache_url or it will not work.</p>
<p>In the imgBrowz0r.php file located in inc find line number 205 and add a rel called prettyPhoto:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cur_directory</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot; title=&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot; rel=&quot;prettyPhoto&quot;&gt;&lt;img src=&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cache_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span></pre></div></div>

<p>If we do not do this then the jQuery prettyPhoto plugin will not work.</p>
<h2>Navigating through the gallery without page reloads</h2>
<p>To do this we need to write our own jQuery code so that when a hyperlink inside the gallery div then we will do an ajax call that will then replace the content in the content_main div.</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;">'.img-directory 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: #660066;">get</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content_main&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #339933;">,</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: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content_main&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content_main&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>So when a hyperlink inside the a div with the class called img-directory is clicked we will get the href from the hyperlink and retrieve that page using $.get(). We will then slide up the element until the content has loaded and then the elemnt will slide back down and contain the content we requested. We also return false so that the page does not reload.</p>
<p>We do the same for the breadcrumbs so we can navigate between them without the page refreshing also:</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;">'.img-breadcrumbs'</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: #660066;">get</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content_main&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideUp</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;slow&quot;</span><span style="color: #339933;">,</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: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content_main&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content_main&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">slideDown</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</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 entire index.php page should look like so:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
	&lt;title&gt;TheTutorialBlog.com | Photo Gallery&lt;/title&gt;
	&lt;script src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	google.load(&quot;jquery&quot;, &quot;1.3.2&quot;);
	&lt;/script&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;css/prettyPhoto.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;no title&quot; charset=&quot;utf-8&quot;&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;css/gallery.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; title=&quot;no title&quot; charset=&quot;utf-8&quot;&gt;
	&lt;script src=&quot;js/jquery.prettyPhoto.js&quot;&gt;&lt;/script&gt;
&nbsp;
	&lt;script&gt;
		$(document).ready(function(){
		// prettyPhoto
			$(&quot;a[rel^='prettyPhoto']&quot;).prettyPhoto({
				showTitle: false
			});
&nbsp;
			$('.img-directory a').click(function(){
				$.get($(this).attr(&quot;href&quot;), function(data){
					$(&quot;#content_main&quot;).slideUp(&quot;slow&quot;, function(){
					$(&quot;#content_main&quot;).html(data)}), $(&quot;#content_main&quot;).slideDown()
				});
				return false;
			})
&nbsp;
			$('.img-breadcrumbs').click(function(){
				$.get($(this).attr(&quot;href&quot;), function(data){
					$(&quot;#content_main&quot;).slideUp(&quot;slow&quot;, function(){
					$(&quot;#content_main&quot;).html(data)}), $(&quot;#content_main&quot;).slideDown()
				});
				return false;
			});
		});
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'inc/imgbrowz0r.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// These are all settings (set to default). The settings are not validated since you have to configure everything.</span>
<span style="color: #666666; font-style: italic;">// There is a chance that ImgBrowz0r stops working if you enter the wrong values.</span>
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #666666; font-style: italic;">// Directory settings. These are required. Without trailing slash. (required)</span>
	<span style="color: #0000ff;">'images_dir'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'images/gallery'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cache_dir'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'images/cache'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Url settings. These are required. Without trailing slash. (required)</span>
	<span style="color: #666666; font-style: italic;">// %PATH% is replaced with the directory location and page number</span>
	<span style="color: #0000ff;">'main_url'</span>                 <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http://localhost:8888/tutorials/jquery_gallery/index.php?q=%PATH%'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'images_url'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http:///localhost:8888/tutorials/jquery_gallery/images/gallery'</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'cache_url'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'http:///localhost:8888/tutorials/jquery_gallery/images/cache'</span><span style="color: #339933;">,</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Sorting settings (optional)</span>
	<span style="color: #0000ff;">'sort_by'</span>                  <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// 1 = filename, 2 = extension (png, gif, etc.), 3 = inode change time of file</span>
	<span style="color: #0000ff;">'sort_order'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// true = ascending, false = descending</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Thumbnail settings (optional)</span>
	<span style="color: #0000ff;">'thumbs_per_page'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Amount of thumbnails per page</span>
	<span style="color: #0000ff;">'max_thumb_row'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Amount of thumbnails on a row</span>
	<span style="color: #0000ff;">'max_thumb_width'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Maximum width of thumbnail</span>
	<span style="color: #0000ff;">'max_thumb_height'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Maximum height of thumbnail</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Time settings (optional)</span>
	<span style="color: #0000ff;">'time_format'</span>              <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'F jS, Y'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Date formatting. Look at the PHP date() for help: http://nl3.php.net/manual/en/function.date.php</span>
	<span style="color: #0000ff;">'time_zone'</span>                <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Timezone. Example: 1</span>
	<span style="color: #0000ff;">'enable_dst'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Daylight saving time (DST). Set this to true to enable it.</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Misc settings (optional)</span>
	<span style="color: #0000ff;">'ignore_port'</span>              <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Ignore port in url. Set this to true to ignore the port.</span>
	<span style="color: #0000ff;">'dir_thumbs'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Show a thumbnail in a category box. Default is false.</span>
	<span style="color: #0000ff;">'random_thumbs'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Use random thumbnails for categories. Default is false.</span>
	<span style="color: #0000ff;">'read_thumb_limit'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #666666; font-style: italic;">// See README for information about this setting.</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Start the class</span>
<span style="color: #000088;">$gallery</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> imgbrowz0r<span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// Prepare everything. This function must be called before you call other functions.</span>
<span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Generate navigation and statistics</span>
<span style="color: #000088;">$gallery_breadcrumbs</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">breadcrumbs</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$gallery_pagination</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;div id=&quot;content_main&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Display navigation</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;imgbrowz0r-navigation&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_breadcrumbs</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_pagination</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Display images and directories</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$gallery</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">browse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Display navigation</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;imgbrowz0r-navigation&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_pagination</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$gallery_breadcrumbs</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;&lt;!--content_main--&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<h2>Download</h2>
<p>You can download the files used in this tutorial <a href="http://www.thetutorialblog.com/files/tutorials/jquery_gallery.zip">here</a></p>
<h2>Final words</h2>
<p>I hope this tutorial has been useful for you and that you can take something you have learnt from it and use it in future projects.</p>
<p>Please feel free to leave a comment.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/php/php-gallery-with-no-page-reloads-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Tip: Resolving conflicting problems between jQuery and MooTools or any other Javascript library</title>
		<link>http://www.thetutorialblog.com/text-tutorials/quick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library/</link>
		<comments>http://www.thetutorialblog.com/text-tutorials/quick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 23:51:10 +0000</pubDate>
		<dc:creator>Wez Pyke</dc:creator>
				<category><![CDATA[Text Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[conflict]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[quicktip]]></category>

		<guid isPermaLink="false">http://www.thetutorialblog.com/?p=155</guid>
		<description><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	Recently I wrote quite a huge chunk of jQuery for a website and it worked fine. A few days later I checked back to make sure that everything was working correctly after modifying a few things, but to my surprise none of the jQuery code worked. The problem was that I had added some Mootools [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[	<style>
	#code_div { border: 1px solid #DFF4B5; background-color: #F0FFD2; padding-left: 50px; padding:10px;}
	</style>
	
	<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.thetutorialblog.com%2Ftext-tutorials%2Fquick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.thetutorialblog.com%2Ftext-tutorials%2Fquick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library%2F&amp;source=wezpyke&amp;style=normal&amp;service=bit.ly" height="61" width="50" title="Quick Tip: Resolving conflicting problems between jQuery and MooTools or any other Javascript library" alt=" Quick Tip: Resolving conflicting problems between jQuery and MooTools or any other Javascript library" /><br />
			</a>
		</div>
<p>Recently I wrote quite a huge chunk of jQuery for a website and it worked fine. A few days later I checked back to make sure that everything was working correctly after modifying a few things, but to my surprise none of the jQuery code worked. The problem was that I had added some Mootools code, the Mootools code worked fine but the jQuery code did not. I done some searching and found that the two libraries were conflicting and all it takes is 2 extra lines of code to prevent this from happening.</p>
<p><span id="more-155"></span></p>
<p>If you was to include jQuery and Mootools together this code below would not work:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<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: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello World!&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>But if we simply add <em>jQuery(function($){</em> and <em>});</em> then this code would work the way that we have intended.</p>
<p>The code would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">jQuery<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: #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: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello World!&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>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>More information</h2>
<p>I hope you found this quick tip useful, you can find out more about jQuery conflicts <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">here</a>.</p>
<p>Feel free to leave a comment with your thoughts.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thetutorialblog.com/text-tutorials/quick-tip-resolving-conflicting-problems-between-jquery-and-mootools-or-any-other-javascript-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

