<?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>Web Designer - Defining the internet through beautiful design &#187; Ajax</title>
	<atom:link href="http://www.webdesignermag.co.uk/category/tutorials/ajax-tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdesignermag.co.uk</link>
	<description>Web Design for real people</description>
	<lastBuildDate>Mon, 26 Jul 2010 11:20:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Slideshow effects with jQuery</title>
		<link>http://www.webdesignermag.co.uk/tutorials/slideshow-effects-with-jquery/</link>
		<comments>http://www.webdesignermag.co.uk/tutorials/slideshow-effects-with-jquery/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 08:30:11 +0000</pubDate>
		<dc:creator>Mark Billen</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[effects]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://www.webdesignermag.co.uk/?p=4567</guid>
		<description><![CDATA[
Slideshow transitions with JavaScript using jQuery
jQuery is empowering JavaScript developers to do more than ever before. Used effectively, it can take your photo slideshows to the next level
Let’s face it, JavaScript is making a huge comeback lately as developers find more ways to use it effectively for motion and effects. And the introduction of new frameworks for JavaScript, like jQuery (http://www.jquery.com), allows you to build rock-solid, cross-browser solutions that look and work every bit as good as Flash.
In this tutorial we are going to give a quick introduction to jQuery ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/06/final2.jpg"><img class="alignnone size-full wp-image-4583" title="final" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/06/final2.jpg" alt="final" width="557" height="420" /></a></p>
<p>Slideshow transitions with JavaScript using jQuery</p>
<p>jQuery is empowering JavaScript developers to do more than ever before. Used effectively, it can take your photo slideshows to the next level</p>
<p>Let’s face it, JavaScript is making a huge comeback lately as developers find more ways to use it effectively for motion and effects. And the introduction of new frameworks for JavaScript, like jQuery (http://www.jquery.com), allows you to build rock-solid, cross-browser solutions that look and work every bit as good as Flash.<br />
In this tutorial we are going to give a quick introduction to jQuery and present three different examples of transitions you can add to your next photo slideshow. We’ll start easy with a fade transition, work through an intermediate slide transition and end with an advanced ‘mask-type’ transition (‘mask-type’ because we are faking a mask as there are no real masking abilities in JavaScript yet). When you’re done here, you will clearly see the benefits of using a framework like jQuery for JavaScript, and should have a pretty solid grasp on what you can do in terms of some simple animation. Let’s get started&#8230;</p>
<p>Project files for this tutorial can be <a href="http://www.webdesignermag.co.uk/wp-content/uploads/2009/12/JScript-FX.zip" target="_blank">downloaded here</a>.<br />
This article was originally authored by Matt Wiggins, and featured within Web Designer issue 165<br />
<strong><br />
01 You’ll need jQuery</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/06/step-1.jpg"><img class="alignnone size-full wp-image-4573" title="step-1" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/06/step-1.jpg" alt="step-1" width="500" height="367" /></a></p>
<p>The first step is to download jQuery, a framework built to simplify and speed up JavaScript development. If you’re new to jQuery, you may want to take a minute and go through the basic tutorial. The latest version can be found at the website (http://www.jquery.com) and it’s worth visiting to make sure you have the very latest version.</p>
<p><strong>02 Setup folder/images</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/06/step-2.jpg"><img class="alignnone size-full wp-image-4572" title="step-2" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/06/step-2.jpg" alt="step-2" width="500" height="375" /></a></p>
<p>Set up a folder structure for your project. We kept it simple and created an XHTML file for each example, a folder for our photos, and included jQuery in the root folder of the project. When your folders are set up, choose a set of photos and re-size them so that they are all the same size.</p>
<p><strong>03 XHTML</strong></p>
<p>We will use a simple XHTML structure that includes the same elements across each example. You will need a main wrapper to add some padding, a frame for the photos that hides overflow and adds a border around the images, next/previous buttons and a transition container that will hold the images/mask. As with many of these steps, the full code can be found in the project files.</p>
<p><em>&lt;div id=”wrapper”&gt;<br />
&lt;div id=”frame”&gt;<br />
&lt;!&#8211; photos &#8211;&gt;<br />
&lt;div id=”transition-container”&gt;<br />
&lt;img class=”photo” id=”photo-1” src=”images/photo-<br />
1.jpg” alt=”photo one” /&gt;<br />
&lt;img class=”photo” id=”photo-2” src=”images/photo-<br />
2.jpg” alt=”photo two” /&gt;<br />
&lt;img class=”photo” id=”photo-3” src=”images/photo-<br />
3.jpg” alt=”photo three” /&gt;<br />
&lt;img class=”photo” id=”photo-4” src=”images/photo-<br />
4.jpg” alt=”photo four” /&gt;<br />
&lt;img class=”photo” id=”photo-5” src=”images/photo-</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdesignermag.co.uk/tutorials/slideshow-effects-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a vertical tabbed panel with Spry</title>
		<link>http://www.webdesignermag.co.uk/tutorials/tabbed-panel-with-spry/</link>
		<comments>http://www.webdesignermag.co.uk/tutorials/tabbed-panel-with-spry/#comments</comments>
		<pubDate>Mon, 10 May 2010 16:33:40 +0000</pubDate>
		<dc:creator>Mark Billen</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Spry]]></category>
		<category><![CDATA[tabbed panel]]></category>

		<guid isPermaLink="false">http://www.webdesignermag.co.uk/?p=4356</guid>
		<description><![CDATA[
The Spry Tabbed Panels widget eliminates the need to code. Here we demonstrate how to change the tab orientation and style with CSS
The beauty of multi-tabbed windows is that designers can cram lots of information into a single space. However, creating such an element involves coding. A frightening thought for non-developers, but Dreamweaver eases the burden with the assistance of its Spry Tabbed Panels widget.
The Tabbed Panels widget provides all the necessary assets, JavaScript, HTML and CSS, needed to add tabbed elements into a page. The initial set up is ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/newfinaltabbed.jpg"><img class="alignnone size-full wp-image-4367" title="newfinaltabbed" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/newfinaltabbed.jpg" alt="newfinaltabbed" width="500" height="270" /></a></p>
<p>The Spry Tabbed Panels widget eliminates the need to code. Here we demonstrate how to change the tab orientation and style with CSS</p>
<p>The beauty of multi-tabbed windows is that designers can cram lots of information into a single space. However, creating such an element involves coding. A frightening thought for non-developers, but Dreamweaver eases the burden with the assistance of its Spry Tabbed Panels widget.<br />
The Tabbed Panels widget provides all the necessary assets, JavaScript, HTML and CSS, needed to add tabbed elements into a page. The initial set up is basic, it provides a simple, horizontal, set of tabbed panels with minimal styling.<br />
The accompanying CSS file includes a set of classes that instantly set the orientation of the tabs from horizontal to vertical. This provides the basis of a vertical tabbed panel. To take the widget beyond its standard state the CSS can be modified to change background colours, hover states, fonts and add new content. This tutorial is going to demonstrate how to create the vertical tabs, restyle, add background images and integrate related content to create a much more stylised widget.</p>
<p>(<em>This tutorial orginally appeared in Web Designer issue 163, authored by Steve Jenkins</em>)</p>
<p><strong>01 New class</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/tab1.jpg"><img class="alignnone size-full wp-image-4365" title="tab1" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/tab1.jpg" alt="tab1" width="500" height="386" /></a></p>
<p>The Spry Tabbed Panels code needs to be added. Place the cursor and head to the Insert menu and select Spry&gt;Spry Tabbed Panels and save. The first line in the HTML code contains the div id and class. Change the class from &lt;div id=”TabbedPanels1” class=”TabbedPanels”&gt; to &lt;div id=”TabbedPanels1” class=”VTabbedPanels”&gt; and save.</p>
<p><strong>02 More tabs</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/tab2.jpg"><img class="alignnone size-full wp-image-4359" title="tab2" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/tab2.jpg" alt="tab2" width="500" height="451" /></a></p>
<p>Place the cursor over the current tabs to reveal the blue Spry Tabbed Panels tag and click. The Properties window will revert to Tabbed Panels. Click ‘+’ to add another tab, repeat for each tab. Use the up and down arrows to reposition the currently selected tab. Now select the default tab from the Default panel drop-down list.</p>
<p><strong>03 Change orientation</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/tab3.jpg"><img class="alignnone size-full wp-image-4363" title="tab3" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/05/tab3.jpg" alt="tab3" width="500" height="281" /></a></p>
<p>The tabs are still effectively normal tabs placed to the left of the content. To create vertical tabs, first double-click .VTabbedPanels .TabbedPanelsTab in the CSS panel and select Box. Now add a height and width, ie 25 pixels wide by 325 pixels high and set Float to left so they sit side-by-side.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdesignermag.co.uk/tutorials/tabbed-panel-with-spry/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create an image viewer with Spry</title>
		<link>http://www.webdesignermag.co.uk/tutorials/image-viewer-spry/</link>
		<comments>http://www.webdesignermag.co.uk/tutorials/image-viewer-spry/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 10:18:38 +0000</pubDate>
		<dc:creator>Mark Billen</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[Spry]]></category>
		<category><![CDATA[viewer]]></category>

		<guid isPermaLink="false">http://www.webdesignermag.co.uk/?p=4243</guid>
		<description><![CDATA[
The latest release of the Adobe Spry framework allows designers to create dynamic content the easy way. Here we demonstrate how to create a dynamic image viewer
The introduction of the Spry framework into Dreamweaver has brought a whole new level of dynamic possibilities for web designers. The framework is essentially a collection of assets that includes JavaScript files, CSS examples, effects, widgets and much more which can be integrated into static HTML pages.
This tutorial looks at introducing a couple of JavaScript files, xpath.js and SpryData.js, into the head of a ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/04/finishedpic.jpg"><img class="alignnone size-full wp-image-4244" title="finishedpic" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/04/finishedpic.jpg" alt="finishedpic" width="500" height="309" /></a></p>
<p>The latest release of the Adobe Spry framework allows designers to create dynamic content the easy way. Here we demonstrate how to create a dynamic image viewer</p>
<p>The introduction of the Spry framework into Dreamweaver has brought a whole new level of dynamic possibilities for web designers. The framework is essentially a collection of assets that includes JavaScript files, CSS examples, effects, widgets and much more which can be integrated into static HTML pages.<br />
This tutorial looks at introducing a couple of JavaScript files, xpath.js and SpryData.js, into the head of a page. These provide all the necessary JavaScript code already tried and tested, eliminating the need for designers to write long streams of code. Alongside this, we will show you how to add a data source, in this case an XML file, and use a number of Spry elements to pull information from the data source.<br />
This tutorial is based on two div tags, one to contain the thumbnail images and the other to contain a full-size version of the chosen thumbnail. We will also give some tips on how to style and position the thumbnails and integrate into a standard static HTML page.</p>
<p>This tutorial originally appeared in Web Designer issue 154, authored by Steve Jenkins</p>
<p><strong>01 Get ready</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/04/spry1.jpg"><img class="alignnone size-full wp-image-4257" title="spry1" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/04/spry1.jpg" alt="spry1" width="500" height="370" /></a></p>
<p>Before indulging in any Dreamweaver activity users will need to download the Spry framework for Ajax and create an XML file containing the image information relating to the thumbnails and full-size images needed for the gallery. The latest version of the Spry framework can be found via the Adobe Labs page at http://labs.adobe.com/technologies/spry/. Download the framework – the file is a zipped file – unzip and place the folder in an easy to access location, ie on the desktop, for the time being. We shall come back to the Spry framework folder later in the tutorial.</p>
<p><strong>02 Images</strong></p>
<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2010/04/spry2.jpg"><img class="alignnone size-full wp-image-4246" title="spry2" src="http://www.webdesignermag.co.uk/wp-content/uploads/2010/04/spry2.jpg" alt="spry2" width="500" height="428" /></a></p>
<p>The images to be used in the gallery come in two forms, thumbnail and full-size image. The thumbnails will appear in a separate absolutely positioned div tag and when clicked will display the full-size image in another absolutely positioned div tag. For the purpose of this tutorial all full images are going to be cropped and resized so that they all have the same dimensions. This is not essential, but will give the gallery a uniform look. To complete the image line-up open the image editor of choice and resize all images to the desired dimension. Now return to the newly resized images and create the thumbnails. The full-size images can be simply resized, ie 90 x 90 pixels, to fit the thumbnail gallery, But if the images are a different perspective they will look stretched. Alternatively, the thumbnails do not need to be square. They can retain the same shape as the full-size images. For this tutorial we have made the full-size images 437 pixels x 261 pixels and the thumbnails 135 x 135 pixels. Save the full images into a folder called images and save the thumbnails into a folder called thumbnails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdesignermag.co.uk/tutorials/image-viewer-spry/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Build an AJAX search bar</title>
		<link>http://www.webdesignermag.co.uk/tutorials/build-an-ajax-search-bar/</link>
		<comments>http://www.webdesignermag.co.uk/tutorials/build-an-ajax-search-bar/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 08:30:14 +0000</pubDate>
		<dc:creator>Steve Jenkins</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://www.webdesignermag.co.uk/?p=3214</guid>
		<description><![CDATA[
THE SEARCH BAR HAS BECOME A FIXTURE OF MODERN WEB DESIGN. LEARN HOW TO MAKE YOURS STAND OUT USING AJAX AND JQUERY’S EFFECTS
CREATING AN EFFECTIVE search bar can be tricky. There are lots of features that have become pretty widespread but are difficult to implement. We’re going to create a bar that
has it’s own custom button that integrates with the bar, slidedown live results from an AJAX script and a helper hint that vanishes when you come to use the search bar. As the basis
for our searching, we’re going to ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webdesignermag.co.uk/wp-content/uploads/2009/10/final.jpg"><img class="alignnone size-full wp-image-3218" title="final" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/10/final.jpg" alt="final" width="500" height="355" /></a></p>
<p>THE SEARCH BAR HAS BECOME A FIXTURE OF MODERN WEB DESIGN. LEARN HOW TO MAKE YOURS STAND OUT USING AJAX AND JQUERY’S EFFECTS</p>
<p>CREATING AN EFFECTIVE search bar can be tricky. There are lots of features that have become pretty widespread but are difficult to implement. We’re going to create a bar that<br />
has it’s own custom button that integrates with the bar, slidedown live results from an AJAX script and a helper hint that vanishes when you come to use the search bar. As the basis<br />
for our searching, we’re going to be using the MySQL World Database, a sample database provided by MySQL that contains information on cities and countries. We’re going to use this to<br />
create an city search for a travel agent-style website.</p>
<p><em>Author: Andy Leon | Originally appeared in Issue 159 | <a href="http://www.webdesignermag.co.uk/tutorial-files/issue-159-tutorial-files/" target="_self">Download Tutorial Files</a></em></p>
<p><strong>01 Design and slice</strong><br />
<a href="http://www.webdesignermag.co.uk/wp-content/uploads/2009/10/pic12.jpg"><img class="alignnone size-full wp-image-3217" title="pic1" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/10/pic12.jpg" alt="pic1" width="500" height="234" /></a><br />
In Photoshop, create your search box. We made a box with a single pixel border, inner and outer shadows. We then overlaid an icon of a magnifying glass that will be our button. We<br />
then slice it into two images and save them as “search_box.png” and “search_button.png”.<br />
<strong><br />
02 Create the HTML doc</strong><br />
Open Dreamweaver and start a new HTML document. Make sure the encoding is set to UTF-8 so that the various extended characters that make up the names of foreign cities are<br />
rendered correctly. Insert a &lt;form&gt;, with a &lt;table&gt; inside, and add two &lt;div&gt; tags with IDs “SearchBox” and “SearchButton”.</p>
<p><em>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv=”Content-Type” content=”text/html; charset=utf-8”&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;form action=”” method=”post”&gt;<br />
&lt;table style=”margin: auto; width: 975px;”&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;<br />
&lt;img src=”images/logo.png” /&gt;<br />
&lt;/td&gt;<br />
&lt;td width=”380”&gt;<br />
&lt;div id=”SearchBox”&gt;<br />
&lt;input id=”SearchInput” name=”SearchInput” value=”City Search” /&gt;<br />
&lt;/div&gt;<br />
&lt;div id=”SearchButton”&gt;<br />
&lt;input type=”image” src=”images/search_button.png” /&gt;<br />
&lt;/div&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;</em></p>
<p><em></em><strong>03 Style Divs</strong><em><br />
</em>In the style section of your document, style the first &lt;div&gt; to show your search box image.<br />
Set the “height” and “weight” attributes of both to match those of the images. Set the<br />
“float” attribute to “left” so that they line up left-to-right. Add an &lt;input&gt; tag with type<br />
“image” and the “src” attribute set to your button image.</p>
<p><em>#SearchBox {<br />
background: url(‘images/search_box.png’);<br />
float: left;<br />
height: 60px;<br />
width: 305px;<br />
}<br />
#SearchButton {<br />
float: left;<br />
height: 60px;<br />
width: 70px;<br />
}</em></p>
<p><strong>04 Add an input box<br />
</strong>Add an &lt;input&gt; tag inside the “SearchBox” &lt;div&gt; so that the user can enter the text they want to search for. Set the “name” and “id” attributes to “SearchInput” and the “value”<br />
attribute to “City Search” – this will appear when the page loads so the user knows what the search box is for.</p>
<p><em>&lt;div id=”SearchBox”&gt;<br />
&lt;input id=”SearchInput” name=”SearchInput” value=”City Search” /&gt;<br />
&lt;/div&gt;</em></p>
<p><strong>05 Style the input box</strong><br />
Now style “SearchInput” so that it blends in with the images. Set the “background” and “border” attributes to none so they don’t show. Increase the font size so it matches the size of the image and then adjust the margins to centre it. Set the “outline” property to “none” in order to get rid of that blue glow that some browsers add when you click into an input box. Finally, change the “color” attribute to a light grey so your “City Search” hint text doesn’t look like search text.</p>
<p><em>#SearchInput {<br />
background: none;<br />
border: none;<br />
color: #999999;<br />
font-size: 16px;<br />
outline: none;<br />
margin: 20px;<br />
width: 280px;<br />
}</em></p>
<p><strong>06 Add search results</strong><br />
Add another row to the table and place a &lt;div&gt; tag in the cell underneath your search box to hold your search results. For the best browser compatibility, add another &lt;div&gt; inside<br />
this one, which has the ID “SearchResults”. You can then style the inner div to float over the top of the rest of your content and use relative positioning on the outer div to bring it close to your search box.function repeater() {.</p>
<p><em>&lt;tr&gt;<br />
&lt;td&gt;&lt;/td&gt;<br />
&lt;td&gt;<br />
&lt;div style=”position: relative; left: 20px; top: -48px;”&gt;<br />
&lt;div id=”SearchResults”&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;</em></p>
<p><em></em><strong>07 Style the search results</strong><br />
Style your “SearchResults” &lt;div&gt; by adding a “background” and “width” attribute. You need to set the “position” and “z-index” attributes so it floats above other content. Set the “overflow” attribute to “auto” so that it will expand to fit however many search results there are. Finally, set the “display” attribute to “none” so that it’s hidden when the page loads.</p>
<p><em>#SearchResults {<br />
background: #000000;<br />
display: none;<br />
overflow: auto;<br />
position: absolute;<br />
width: 330px;<br />
z-index: 99;<br />
}</em></p>
<p><strong>08 Focus</strong><br />
Now your structure’s in place, you can start adding some JavaScript, starting with the focus event, which fires when the user clicks or tabs into your search box. You only want to do<br />
two things here – remove the “City Search” text if it’s there, and change the CSS “color” property so that the user is typing in black.</p>
<p><em>$(“#SearchInput”).focus(function() {<br />
if($(“#SearchInput”).val() == “City Search”) {<br />
$(“#SearchInput”).val(“”);<br />
}<br />
$(“#SearchInput”).css(“color”, “#000000”);<br />
});</p>
<p></em><strong>09 Blur</strong><br />
The opposite of focus is the blur event. In this function, check to see what the value of the “SearchInput” box is. If there’s nothing there, add the “City Search” text back in and change the CSS “color” property back to light grey. Finally, use jQuery’s slideUp() function to hide search results if they’re showing.</p>
<p><em>$(“#SearchInput”).blur(function() {<br />
if($(“#SearchInput”).val() == “”) {<br />
$(“#SearchInput”).val(“City Search”);<br />
$(“#SearchInput”).css(“color”, “#999999”);<br />
}<br />
$(“#SearchResults”).slideUp();<br />
});</em></p>
<p><strong>10 Catching key presses</strong><br />
Your third function is attached to the keydown event and is used for trapping keyboard actions. Your event comes through as “e”, and you can use the “which” property to identify which key was pressed. Test the “which” property for the value 8 (corresponding) to the backspace key. If this is the case, trim one character off the end of the search text, for all other cases add the character corresponding to that key code. Then call our AJAX page through the load() function, putting the results in your SearchResults &lt;div&gt;. Then call the slideDown() function, to make sure your results are showing.</p>
<p><em>$(“#SearchInput”).keydown(function(e) {<br />
if(e.which == <img src='http://www.webdesignermag.co.uk/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> {<br />
SearchText = $(“#SearchInput”).val().substring(0, $(“#SearchInput”).val().length-1);<br />
}<br />
else {<br />
SearchText = $(“#SearchInput”).val() + String.fromCharCode(e.which);<br />
}<br />
$(“#SearchResults”).load(“ajax.php”, { SearchInput: SearchText });<br />
$(“#SearchResults”).slideDown();</em></p>
<p><strong>11 Create our AJAX script</strong><br />
Create a new PHP document and save it as “ajax.php”. Call the necessary mysql_connect() and mysql_select_db() functions to get access to the database tables. Then check to make sure that you’ve got “SearchInput” in the $_POST array and put that in a variable called $SearchInput, converting it all to lowercase as you do so.</p>
<p><em>mysql_connect(‘127.0.0.1’, ‘root’, ‘password’);<br />
mysql_select_db(‘world’);<br />
if(isset($_POST[‘SearchInput’])) {<br />
$SearchInput = strtolower($_POST[‘SearchInput’]);</em></p>
<p><strong>12 Run the query</strong><br />
Use your $SearchInput variable to construct a query that searches through the database and brings you your results. In this query you’re using a descending sort on the Population field with a limit of ten. This way, when searching you’ll only get the ten biggest cities that match our search text.</p>
<p><em>$Cities = mysql_query(‘select * from City where Name like “%’.$SearchInput.’%” order by Population desc limit 10’);</em></p>
<p><strong>13 Step through the results</strong><br />
Then use the mysql_fetch_assoc() function to step through the results and output them as &lt;a&gt; links, but there’s more to do inside this loop. You need to use utf8_encode() on the city name to cope with foreign characters. Also use str_replace to wrap each occurrence of your search text in a &lt;span&gt;, with the class “highlight”. Do this twice, the second time using the ucfirst() function to preserve any capital letters. Finally, add a comma and the country code to the end.</p>
<p><em>while($City = mysql_fetch_assoc($Cities)) {<br />
$Name = utf8_encode($City[‘Name’]);<br />
$Name = str_replace($SearchInput, ‘&lt;span class=”highlight”&gt;’.$SearchInput.’&lt;/span&gt;’, $Name);<br />
$Name = str_replace(ucfirst($SearchInput), ‘&lt;span class=”highlight”&gt;’.ucfirst($SearchInput).’&lt;/span&gt;’, $Name);<br />
$Name = $Name.’, ‘.$City[‘CountryCode’];<br />
echo ‘&lt;a href=””&gt;’.$Name.’&lt;/a&gt;’;</em></p>
<p><strong>14 Add the highlighting</strong><br />
Finally, add some additional styling to your HTML page so that the “highlight” class is displayed in blue. This means that your search text shows up in your results. It’s up to you what to do with the search results once you’ve got them. Change the “action” attribute of the &lt;form&gt; to provide a search page or change the “href” attributes of the &lt;a&gt; tags in our “ajax. php” file.while($City = mysql_fetch_assoc($Cities)) {. The full code for this step can be found on the cover disc, titled step14code.txt. We’ve included a snippet below for reference.<br />
<em><br />
#SearchResults a {<br />
color: #FFFFFF;<br />
display: block;</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdesignermag.co.uk/tutorials/build-an-ajax-search-bar/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Build the BBC homepage</title>
		<link>http://www.webdesignermag.co.uk/blog/build-the-bbc/</link>
		<comments>http://www.webdesignermag.co.uk/blog/build-the-bbc/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 09:30:34 +0000</pubDate>
		<dc:creator>Mark Billen</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Dreamweaver]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[BBC]]></category>
		<category><![CDATA[homepage]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[site design]]></category>

		<guid isPermaLink="false">http://www.webdesignermag.co.uk/?p=2860</guid>
		<description><![CDATA[
The BBC’s brilliant homepage redesign has created quite a stir in the web community. Now See how it was done!
The BBC’s homepage is a stunning example of first-class Web 2.0 design. As well as presenting an elegant look and feel, it allows users to customise their experience in a genuinely useful way. You can change the content to reflect your interests, the layout to suit your behaviour online and even the colour scheme to please your taste.
It looks complicated, but it’s actually quite easy to do. In this tutorial, we’ll ...]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2866" title="beebfinal" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/beebfinal.jpg" alt="beebfinal" width="500" height="299" /></p>
<p>The BBC’s brilliant homepage redesign has created quite a stir in the web community. Now See how it was done!</p>
<p>The BBC’s homepage is a stunning example of first-class Web 2.0 design. As well as presenting an elegant look and feel, it allows users to customise their experience in a genuinely useful way. You can change the content to reflect your interests, the layout to suit your behaviour online and even the colour scheme to please your taste.<br />
It looks complicated, but it’s actually quite easy to do. In this tutorial, we’ll show you exactly how to re-create the BBC’s homepage, using XML feeds from the BBC to provide content. Like the BBC, we will use the jQuery library and its many plug-ins to build a rich interface that allows users to customise the content. We’ll use cookies to remember the settings and layout so that when you return, everything’s where you left it. By the end of this tutorial you’ll know exactly how one of the most talked-about redesigns was done – and have a BBC-style homepage of your very own. Download the <a href="http://www.webdesignermag.co.uk/wp-content/uploads/2009/03/145bbcstylesitedesignwithajax.zip" target="_blank">project assets here</a></p>
<p><strong>01 Site definition</strong></p>
<p><strong></strong><img class="size-full wp-image-2870 alignnone" title="screenshot_1" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/screenshot_1.jpg" alt="screenshot_1" width="500" height="313" /><br />
Define a new site in Dreamweaver with PHP MySQL enabled – this site requires PHP so the computer/server you build it on must have it available. Copy across the files from the starting_files directory on the CD to your home directory. Open the index.php and the CSS&gt;styles.css files.</p>
<p><strong>02 BBC feeds</strong></p>
<p><img class="alignnone size-full wp-image-2867" title="screenshot_2" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/screenshot_2.jpg" alt="screenshot_2" width="500" height="313" /></p>
<p>We will use XML feeds from the BBC website to add content, added as draggable divs, with rollover images and links at the top and text feeds underneath. We need to create two XSLT documents to format these. Select File&gt;New&gt;XSLT (fragment) and save as ‘image_feeds.xsl’.</p>
<p><strong>03 Image feeds</strong></p>
<p><img class="alignnone size-full wp-image-2871" title="screenshot_3" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/screenshot_3.jpg" alt="screenshot_3" width="500" height="313" /></p>
<p>Select Attach a remote file on the internet, and enter the URL of the BBC News’s XML file: http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml. In Design view, follow rss&gt;channel&gt;item and drag ‘link’, ‘title’ and ‘thumbnail’ onto the canvas from the bindings pane.</p>
<p><strong>04 Repeating images</strong></p>
<p><img class="alignnone size-full wp-image-2862" title="screenshot_4" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/screenshot_4.jpg" alt="screenshot_4" width="500" height="313" /></p>
<p>We want to display multiple images in our panel, so we need to add an XSLT repeat region. In Design view, highlight all of the fields you just dragged onto the page. Then under the XSLT tab, select Repeat Region. Under Select node to repeat under, select item and click OK.</p>
<p><strong>05 List of images</strong></p>
<p><img class="alignnone size-full wp-image-2874" title="screenshot_5" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/screenshot_5.jpg" alt="screenshot_5" width="500" height="313" /></p>
<p>We need to format this data as a list of images. In Code view, enter ul tags outside of the xsl:for-each loop, and inside, add &lt;li&gt; tags with &lt;img&gt; and &lt;a&gt; tags inside them. Set the attributes of these to the values from the XML feed – see Helper Files&gt;image_feeds_step_5.xsl on the CD.</p>
<p><strong>06 First three images</strong></p>
<p><img class="alignnone size-full wp-image-2864" title="screenshot_6" src="http://www.webdesignermag.co.uk/wp-content/uploads/2009/08/screenshot_6.jpg" alt="screenshot_6" width="500" height="313" /></p>
<p>In Code view, click inside &lt;xsl:for-each select=”rss&gt;channel&gt;item”&gt;, and select XSLT&gt;Conditional Region. In the Property Inspector, select the lightning bolt and then Build filter. Click the plus button and enter position() in the where field, &lt;= as the operator and three as the value.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webdesignermag.co.uk/blog/build-the-bbc/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
