<?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>Diego Pessoa &#187; Web developing</title>
	<atom:link href="http://www.diegopessoa.com/lang/en/categories/web-developing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.diegopessoa.com</link>
	<description></description>
	<lastBuildDate>Thu, 07 Jan 2010 04:22:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Solving the problem of &#8220;back&#8221; button in Ajax applications</title>
		<link>http://www.diegopessoa.com/lang/en/2009/03/09/solving-the-problem-of-back-button-in-ajax-applications</link>
		<comments>http://www.diegopessoa.com/lang/en/2009/03/09/solving-the-problem-of-back-button-in-ajax-applications#comments</comments>
		<pubDate>Tue, 10 Mar 2009 00:18:27 +0000</pubDate>
		<dc:creator>Diego Pessoa</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[Web developing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Web Accessibility]]></category>

		<guid isPermaLink="false">http://www.diegopessoa.com/?p=102</guid>
		<description><![CDATA[














Who here has always dreamed in do Ajax applications that the user can freely navigate using the back and forward buttons, and furthermore, can bookmark specific sections? In theory, this isn’t possible, since the “Ajax” is used by most to reload just some page blocks, keeping active the main page and, consequently, precluding the back [...]]]></description>
			<content:encoded><![CDATA[














<p><span lang="en">Who here has always dreamed in do Ajax applications that the user can freely navigate using the back and forward buttons, and furthermore, can bookmark specific sections? In theory, this isn’t possible, since the “Ajax” is used by most to reload just some page blocks, keeping active the main page and, consequently, precluding the back button or bookmarks use. Otherwise we’d have the good old reload of the entire page.</span></p>
<p><span lang="en">But then, how the Gmail works? It’s totally in Ajax and yet you can navigate using the back button.  If you put a link like: http://mail.google.com/mail/#compose in the address bar, it will open the e-mail composition screen normally. The big secret is in the #anchors.<br />
Anchor Oriented Navigation</span></p>
<p><span lang="en">A very interesting thing of the anchors is that they allow you to use the back and forward button, for example, without generate no one full page request and without leaving that page, so, how could we do this?</span></p>
<p><span lang="en">The first step is create a Javascript file that will be every time verifying if some anchor is active, if so, it sends the Ajax request calling the specific section, based on anchor’s name, that will be loaded inside the main block. Simple, isn’t it?</span></p>
<p><span lang="en">As is usual for JavaScript today, we will use jQuery, so remember to include the library file in your application.</span></p>
<p><span lang="en">We would then have a file named &#8220;core.js&#8221;, thus:</span></p>
<div lang="en">
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">* Loading the page, the timer is started to check if there is an active anchor to each 300ms. */</span></div>
</li>
<li class="li1">
<div class="de1">$<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">setInterval<span class="br0">&#40;</span><span class="st0">&#34;checkAnchor()&#34;</span>, <span class="nu0">300</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> currentAnchor = <span class="kw2">null</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">* Method to check if there is some anchor change, if so, sends the Ajax request.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li2">
<div class="de2"><span class="kw2">function</span> checkAnchor<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span>currentAnchor != document.<span class="me1">location</span>.<span class="me1">hash</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">currentAnchor = document.<span class="me1">location</span>.<span class="me1">hash</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">* If doesn’t have no one active anchor, the default section is loaded</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span>!currentAnchor<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">query = <span class="st0">&#34;section=home&#34;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">else</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">* Creates the result string. Converting the url: URL/#fotos&#38;amp;id=2 in URL/?section=fotos&#38;amp;id=2</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">* */</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> splits = currentAnchor.<span class="me1">substring</span><span class="br0">&#40;</span><span class="nu0">1</span><span class="br0">&#41;</span>.<span class="me1">split</span><span class="br0">&#40;</span><span class="st0">&#8216;&#38;amp;&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> section = splits<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="kw1">delete</span> splits<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> params = splits.<span class="me1">join</span><span class="br0">&#40;</span><span class="st0">&#8216;&#38;amp;&#8217;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> query = <span class="st0">&#34;section=&#34;</span> + section + params;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li2">
<div class="de2"><span class="coMULTI">* Sends the request</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1">$.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&#34;callbacks.php&#34;</span>,query, <span class="kw2">function</span><span class="br0">&#40;</span>data<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">$<span class="br0">&#40;</span><span class="st0">&#34;#main_block&#34;</span><span class="br0">&#41;</span>.<span class="me1">html</span><span class="br0">&#40;</span>data<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p><span lang="en">OK, the content will be loaded in th e element of ID “main_block” through the Ajax request result that being sent to the page “callbacks.php” in GET Querystring format.</span></p>
<p><span lang="en">To catch it, we would have something like this:</span></p>
<div lang="en">
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$section</span> = <a href="http://www.php.net/addslashes"><span class="kw3">addslashes</span></a><span class="br0">&#40;</span><a href="http://www.php.net/strip_tags"><span class="kw3">strip_tags</span></a><span class="br0">&#40;</span><span class="re0">$_GET</span><span class="br0">&#91;</span><span class="st0">&#8217;section&#8217;</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$page</span> = <span class="st0">&#34;pages/&#34;</span>.<span class="re0">$section</span>.<span class="st0">&#34;.php&#34;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/file_exists"><span class="kw3">file_exists</span></a><span class="br0">&#40;</span><span class="re0">$page</span><span class="br0">&#41;</span><span class="br0">&#41;</span>  <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">include</span><span class="br0">&#40;</span><span class="re0">$page</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
</div>
<p><span lang="en">Thus, we would need only a folder called “pages” containing the pages with the anchors’ names.</span></p>
<p><span lang="en">And to call each section, a simple html page with links like:</span></p>
<p><span lang="en">http://mysite.com/#photos</span></p>
<p><span lang="en">It would be detected by the Javascript method “checkAnchor()”, and will be call a php request loading the page named photos.php inside the directory “pages”. It will exhibited inside the block “#main_block” that is contained in the same page of the clicked link, and the best of all, you can back, forward and bookmark the sections you want.</span></p>
<p><span lang="en">To better illustrate the example, I made a blatant copy (haha) of the PHP-PB’s site, with the only difference of having Ajax navigation through anchors (the original has normal navigation). Access the link: <a href="http://www.diegopessoa.com/php-pb-ajax" target="_blank">http://www.diegopessoa.com/php-pb-ajax</a></span></p>
<p><span lang="en">If you want to download the working example, <a href="http://diegopessoa.com/php-pb-ajax/%5bdiegopessoa.com%5dAjaxBack.zip" target="_blank">click here</a>!﻿</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.diegopessoa.com/lang/en/2009/03/09/solving-the-problem-of-back-button-in-ajax-applications/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>II PHP-PB Meeting</title>
		<link>http://www.diegopessoa.com/lang/en/2009/03/09/ii-php-meeting</link>
		<comments>http://www.diegopessoa.com/lang/en/2009/03/09/ii-php-meeting#comments</comments>
		<pubDate>Mon, 09 Mar 2009 23:47:28 +0000</pubDate>
		<dc:creator>Diego Pessoa</dc:creator>
				<category><![CDATA[WCAG 2.0]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[ii-encontro-php-pb]]></category>

		<guid isPermaLink="false">http://www.diegopessoa.com/?p=99</guid>
		<description><![CDATA[


Hi people,
In the last saturday, March 7, was held in the Shopping Sebrae auditorium, the II PHP Paraiba Meeting. I wish to express my most sincere congratulation to all who participated in this event which is becoming increasingly greater, showing that the PHP Paraiba community is active and partipatory!
For those who could not follow the [...]]]></description>
			<content:encoded><![CDATA[


<p><span lang="en">Hi people,</span></p>
<p><span lang="en">In the last saturday, March 7, was held in the Shopping Sebrae auditorium, the II PHP Paraiba Meeting. I wish to express my most sincere congratulation to all who participated in this event which is becoming increasingly greater, showing that the PHP Paraiba community is active and partipatory!</span></p>
<p><span lang="en">For those who could not follow the event, I am providing below the slides from my presentation, &#8220;Accessible Web Applications.&#8221;</span></p>

<div style="width: 425px; text-align: left;"><a title="Aplicações Web Acessíveis" href="http://www.slideshare.net/diegoep/aplicaes-web-acessveis?type=presentation"><span lang="en">Accessible Web Applications</span><br />
</a></div>
<div style="width: 425px; text-align: left;"><a style="font: 14px Helvetica,Arial,Sans-serif; display: block; margin: 12px 0 3px 0; text-decoration: underline;" title="Aplicações Web Acessíveis" href="http://www.slideshare.net/diegoep/aplicaes-web-acessveis?type=presentation"></a><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=aplicacoeswebacessiveis-090309010234-phpapp01&#38;stripped_title=aplicaes-web-acessveis" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://static.slideshare.net/swf/ssplayer2.swf?doc=aplicacoeswebacessiveis-090309010234-phpapp01&#38;stripped_title=aplicaes-web-acessveis" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>



<h4><span lang="en">See the others presentations of the meeting:</span></h4>
<p><span lang="en"><a href="http://www.slideshare.net/tag/ii-encontro-php-pb">http://www.slideshare.net/tag/ii-encontro-php-pb</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.diegopessoa.com/lang/en/2009/03/09/ii-php-meeting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WCAG! WCAG!</title>
		<link>http://www.diegopessoa.com/lang/en/2009/02/02/wcag-wcag</link>
		<comments>http://www.diegopessoa.com/lang/en/2009/02/02/wcag-wcag#comments</comments>
		<pubDate>Mon, 02 Feb 2009 03:47:30 +0000</pubDate>
		<dc:creator>Diego Pessoa</dc:creator>
				<category><![CDATA[WCAG 2.0]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://www.diegopessoa.com/?p=93</guid>
		<description><![CDATA[





In the beginning of 2009 year, the W3C announced new standards to help the developers to create more accessible sites, ie, cover more adequately to disabled and old users. This is the second WCAG (Web Content Accessibility Guidelines) version, this new standard produced by the Web Accessibility Initiative (WAI) of W3C will attend a huge [...]]]></description>
			<content:encoded><![CDATA[





<p><span lang="en">In the beginning of 2009 year, the W3C announced new standards to help the developers to create more accessible sites, ie, cover more adequately to disabled and old users. This is the second WCAG (Web Content Accessibility Guidelines) version, this new standard produced by the Web Accessibility Initiative (WAI) of W3C will attend a huge range of content (such text, images, audio and video) and web applications, allowing better conformance tests  and still will prove more flexibility and a larger innovation potential to the web developers. The WCAG 2.0 is easier to understand and to use. Just see the technical and educational material available.</span></p>
<p><span lang="en">The WCAG 2.0 target the web access difficulties experienced by people with limited vision, hearing, physical, cognitive, neurological and by old users with needs to access the web. Following four principles:</span></p>
<p><span lang="en">Perceivable &#8211; Information and user interface components must be presentable to users in ways they can perceive. (For example, provide alternative texts to images, caption mode for audio, display content adaptable to different ways to be shown and use color contrast).</span></p>
<p><span lang="en">Operable &#8211; User interface components and navigation must be operable. (Provide access to features via keyboard, offer enough time to read and insert data, avoid images that can cause convulsions and improve navigability.</span></p>
<p><span lang="en">Understandable &#8211; Information and the operation of user interface must be understandable. (Provide legible and predictable content to help users to avoid and correct errors)</span></p>
<p><span lang="en">Robust &#8211; Maximize compatibility with current and future user agents, including assistive technologies.</span></p>
<p><span lang="en">To who already wants to begin to study the new guidelines, <a href="http://www.w3.org/TR/WCAG20/">visit the reference guide</a>.</span></p>
<p><span lang="en">To motivate you, see the video with the WCAG 2 theme:</span></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/gtuna2AWvqk&#38;hl=pt-br&#38;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/gtuna2AWvqk&#38;hl=pt-br&#38;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.diegopessoa.com/lang/en/2009/02/02/wcag-wcag/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
