<?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"
	>

<channel>
	<title>action online &#187; Code</title>
	<atom:link href="http://www.actiononline.biz/category/web/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.actiononline.biz</link>
	<description>Technology &#038; Business blog of YDS Web Solution</description>
	<pubDate>Wed, 05 Nov 2008 01:20:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>XML PHP Cake</title>
		<link>http://www.actiononline.biz/web/xml-php-cake/</link>
		<comments>http://www.actiononline.biz/web/xml-php-cake/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 16:18:29 +0000</pubDate>
		<dc:creator>Benj Arriola</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[CakePHP]]></category>

		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.actiononline.biz/?p=356</guid>
		<description><![CDATA[I once blogged about Cake PHP before, and this is simply like the Ruby on Rails of PHP. Today is the age of XML data having so many applications out there, so many platforms and interoperability and integration is really key&#8230; but I have never seen XML used for a Cake like this.
Hat tip to [...]]]></description>
			<content:encoded><![CDATA[<p>I once blogged about <a href="http://www.actiononline.biz/web/want-some-cake/" target="_self">Cake PHP</a> before, and this is simply like the Ruby on Rails of PHP. Today is the age of XML data having so many applications out there, so many platforms and interoperability and integration is really key&#8230; but I have never seen XML used for a Cake like this.<span id="more-356"></span></p>
<div id="attachment_357" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-357" title="XML Cake!" src="http://www.actiononline.biz/wp-content/uploads/2008/08/xmlnerdcake.jpg" alt="XML Cake!" width="500" height="375" /><p class="wp-caption-text">XML Cake!</p></div>
<p>Hat tip to <a href="http://twitter.com/MoinAnjum" target="_blank">MoinAnjum</a>&#8217;s  <a href="http://www.anewmorning.com/2008/08/11/nerd-cake/">A New Morning!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.actiononline.biz/web/xml-php-cake/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to getElementByClass in Javascript - The Code</title>
		<link>http://www.actiononline.biz/web/code/how-to-getelementsbyclass-in-javascript-the-code/</link>
		<comments>http://www.actiononline.biz/web/code/how-to-getelementsbyclass-in-javascript-the-code/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 00:08:53 +0000</pubDate>
		<dc:creator>Benj Arriola</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://webgasm.actiononline.biz/code/?p=349</guid>
		<description><![CDATA[
A colleague of mine at work, Patrick Alcisto, asked me how a getElementByClass is done in JavaScript since getElementByID exists in JavaScript but getElementbyClass does not exist. And I have been using a standard script ever since 2004 that I just always have handy in my previous work, but sometimes, looking and remembering which websites [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.actiononline.biz/wp-content/uploads/2007/11/getelementbyclass-vs-getelementbyid.jpg" alt="getElementByClass - How to, sample code." /></p>
<p>A colleague of mine at work, Patrick Alcisto, asked me how a <strong>getElementByClass</strong> is done in JavaScript since <strong>getElementByID</strong> exists in JavaScript but getElementbyClass does not exist. And I have been using a standard script ever since 2004 that I just always have handy in my previous work, but sometimes, looking and remembering which websites I applied it on takes some time. So just to make it easy for me find the code when I need it, might as well post it on my blog so it is easy to find. Check the sample getElementsByClass code below:<span id="more-349"></span></p>
<h3>The getElementByClass example code.</h3>
<blockquote><p>/* getElementByClass<br />
/**********************/</p>
<p>var allHTMLTags = new Array();</p>
<p>function getElementByClass(theClass) {</p>
<p>//Create Array of All HTML Tags<br />
var allHTMLTags=document.getElementsByTagName(&#8221;*&#8221;);</p>
<p>//Loop through all tags using a for loop<br />
for (i=0; i&lt;allHTMLTags.length; i++) {</p>
<p>//Get all tags with the specified class name.<br />
if (allHTMLTags[i].className==theClass) {</p>
<p>//Place any code you want to apply to all<br />
//pages with the class specified.<br />
//In this example is to &#8220;display:none;&#8221; them<br />
//Making them all dissapear on the page.</p>
<p>allHTMLTags[i].style.display=&#8217;none&#8217;;</p>
<p>}<br />
}<br />
}</p></blockquote>
<p>Just a brief explanation to the less knowledgeable in JavaScript how this sample code of getElementByClass works is you are simply taking note of all HTML tags present on the page. And going through a loop check each tag, placing them in an array. Then for each member of the array, check if any of them has a class name. And check if it is the class you are specifying.</p>
<p>Feel free to use the code above and share to the world.</p>
<p>Since this is a function, you just tie it up to any event like an onclick or onmouseover on within other functions. Here is an example where someone clicks on a link and will apply the JavaScript code in getElementByClass to a div.</p>
<blockquote><p>&lt;div class=&#8221;whatever&#8221;&gt;&#8230;&lt;/div&gt;</p>
<p>&#8230;</p>
<p>&lt;a href=&#8221;&#8230;&#8221; onclick=&#8221;getElementByClass(&#8217;whatever&#8217;);&#8221;&gt;&lt;img src=&#8221;&#8230;&#8221;&gt;&lt;/a&gt;</p></blockquote>
<p>Just a small note, not all browsers support all JavaScript versions. This script may not work in older browsers. Where getElementByID will not work either. Another note is if you did a copy and paste to the codes above, be sure to change the doublequotes and ( &#8221; )  single quotes ( &#8216; ) with the plain text ones so you get no errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actiononline.biz/web/code/how-to-getelementsbyclass-in-javascript-the-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Replace Boring HTML Checkboxes with Well Designed HTML CSS/Javascript Checkbox</title>
		<link>http://www.actiononline.biz/web/the-power-of-css-and-javascript-in-the-palm-of-your-hands/</link>
		<comments>http://www.actiononline.biz/web/the-power-of-css-and-javascript-in-the-palm-of-your-hands/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 17:25:21 +0000</pubDate>
		<dc:creator>Al Khalel Le Beau</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Web]]></category>

		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://webgasm.actiononline.biz/web-design/?p=320</guid>
		<description><![CDATA[Here is an example of a plain HTML checkbox. It looks boring.

Now check this enhanced checkbox using CSS and Javascript. It looks better.

Impressed? But how was this possible?
I stumbled upon this page on the Internet showing how you can change the boring checkbox into an exciting one. What&#8217;s great about this is that you no [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an example of a plain HTML checkbox. It looks boring.<br />
<img src="http://www.actiononline.biz/wp-content/uploads/2007/09/before.jpg" alt="Boring Checkbox" /></p>
<p>Now check this enhanced checkbox using CSS and Javascript. It looks better.<br />
<img src="http://www.actiononline.biz/wp-content/uploads/2007/09/after.jpg" alt="Exciting Checkbox" /></p>
<p>Impressed? But how was this possible?<span id="more-320"></span></p>
<p><a href="http://brainerror.net/media/scripts/js/checkbox2/demo.html">I stumbled upon this page</a> on the Internet showing how you can change the boring checkbox into an exciting one. What&#8217;s great about this is that you no longer have to change your existing code. By embedding this code, you can easily customize the look of the checkboxes any way you want.</p>
<blockquote><p>&lt;script type=”text/javascript” src=”checkbox.js”&gt;&lt;/script&gt;</p></blockquote>
<p>Don’t you think that this is simply amazing? You can’t do this with plain HTML but with the use of a simple code, you can now make your checkboxes look better and exciting.</p>
<p>This custom checkbox is one of the examples of the importance of CSS. Most modern websites now use CSS (Cascading Style Sheets), either full CSS or partial. Before CSS even existed, when we do major design updates we either change all the pages, taking so much time. But with CSS, work has become easier and faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actiononline.biz/web/the-power-of-css-and-javascript-in-the-palm-of-your-hands/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Want some cake?</title>
		<link>http://www.actiononline.biz/web/want-some-cake/</link>
		<comments>http://www.actiononline.biz/web/want-some-cake/#comments</comments>
		<pubDate>Fri, 20 Oct 2006 19:51:35 +0000</pubDate>
		<dc:creator>Benj Arriola</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://uncategorized.actiononline.biz/2006/10/20/want-some-cake/</guid>
		<description><![CDATA[
I have been making websites since 1997. And has gone into web development also since 1999 and started out with the server-side language Miva, and soon moved over to PHP starting with the PHP Manual. But maybe I am one of the worst PHP programmers with spaghetti code everywhere. I guess I have just started [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image217" alt="Programming Code" src="http://www.actiononline.biz/wp-content/uploads/2006/10/code.jpg" /></p>
<p>I have been making websites since 1997. And has gone into web development also since 1999 and started out with the server-side language <a target="_blank" href="http://www.miva.com">Miva</a>, and soon moved over to <a target="_blank" href="http://www.php.net">PHP</a> starting with the <a target="_blank" href="http://php.geeksmanual.com">PHP Manual</a>. But maybe I am one of the worst PHP programmers with spaghetti code everywhere. I guess I have just started cleaning up my code with my own library of functions, classes and include files late 2003. And up to now there are still a mess.</p>
<p>I wanted to chat with <a target="_blank" href="http://tech.mikelopez.info/">Mike Lopez</a> one time about <a href="http://smarty.php.net">Smarty</a>, but he was offline and I had a chat with Reine Sison who I know uses Smarty also. I was getting her advice if Smarty is something I need to learn and get into, but it ended up with her advising me not to learn Smarty and just do the <a target="_blank" href="http://en.wikipedia.org/wiki/Model-view-controller"><acronym title="Model-View-Controller">MVC</acronym></a> architectural pattern. She further told me about <a target="_blank" href="http://www.cakephp.com">CakePHP and says this is like the PHP version of Ruby on Rails</a>. Sounds like something I definitely need to try out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actiononline.biz/web/want-some-cake/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS &#60;Body&#62; ID used like &#8220;if&#8221; statements</title>
		<link>http://www.actiononline.biz/web/css-id-used-like-if-statements/</link>
		<comments>http://www.actiononline.biz/web/css-id-used-like-if-statements/#comments</comments>
		<pubDate>Sat, 27 May 2006 15:56:36 +0000</pubDate>
		<dc:creator>Benj Arriola</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://webgasm.actiononline.biz/code/2006/05/27/css-id-used-like-if-statements/</guid>
		<description><![CDATA[Is this CSS Body ID thing new?
This is not a new technique, and in fact in the company where I used to work, everyone is doing this. I guess it was also due to the great in that company that cascade the knowledge down to the every other employee, but as I randomly asked other [...]]]></description>
			<content:encoded><![CDATA[<h3>Is this CSS Body ID thing new?</h3>
<p>This is not a new technique, and in fact in the company where I used to work, everyone is doing this. I guess it was also due to the great in that company that cascade the knowledge down to the every other employee, but as I randomly asked other people who make tableless CSS websites, <em>do you use body ids?</em> And explain how they are used like programming control structures like <em>if..then</em> conditional statements. Many of them still say no.</p>
<h3>What is this for?</h3>
<p>Making CSS driven websites is very ideal with all the advantages you have probably read about already, and one of these advantages is for doing global changes to a number of pages by simply changing the stylesheet. Which makes this type of website building ideal for mobile devices as well if done correctly, changing the appearance of a website for another type of screen will simply mean changing the stylesheet.</p>
<p>Many parts of pages look the same, that it is like using a template with a template of styles but of course, not all pages are the same. There are still parts that are not the same of course. And this is where this technique comes in, you have general rules for many parts of the page, and you have exceptions to the rules on some parts like in graphic titles of a page, changing mastheads, selected current buttons on spritenavs, removing parts for some pages.</p>
<h3>How to do it</h3>
<p>Let me explain by example, but before I do, let me just show the concept first. In your stylesheet, you are going to have something like this:</p>
<blockquote><p> #general-rule{<br />
&#8230;<br />
}</p></blockquote>
<p>And for instance, you have these pages: index.html, about.html and contact.html, they will then have these body tags respectively in their individual files:</p>
<blockquote><p> &lt;body id=&#8221;index&#8221;&gt;, &lt;body id=&#8221;about&#8221;&gt; and &lt;body id=&#8221;contact&#8221;&gt;</p></blockquote>
<p>Now to make exceptions to the rule of the general rule, you do something like this to your stylesheet:</p>
<blockquote><p> #general-rule{<br />
&#8230;<br />
}</p>
<p>body#index #general-rule{<br />
&#8230;<br />
}<br />
body#about #general-rule{<br />
&#8230;<br />
}<br />
body#contact #general-rule{<br />
&#8230;<br />
}</p></blockquote>
<p>In a way, they seem to act like programming control structures, like a nested if&#8230;then, or even like a switch&#8230;case if you wish to look at it that way. The styles that are in body#index will only apply to the index.html since it has the body tag id index and will not be used on other pages.</p>
<h3>I can&#8217;t picture it, show me a working example</h3>
<p>Here is one of our latest websites, a website for <a href="http://www.pillowsanddesigns.com/" title="Asian-Inspired Pillows, Tablerunners, Flower Vases, Candle Holders and more" target="_blank">Pillows and Designs by Melody</a>. If you <a href="http://www.pillowsanddesigns.com/css/layout.css" target="_blank">check the CSS file</a>, you find this part:</p>
<blockquote><p> #container-top{<br />
width:778px;<br />
padding:0px;<br />
margin:0px;<br />
}</p>
<p>body#index #container-top{<br />
background:url(../images/container-top-index.jpg) top no-repeat;}<br />
body#about #container-top{<br />
background:url(../images/container-top-about.jpg) top no-repeat;}<br />
body#contact #container-top{<br />
background:url(../images/container-top-contact.jpg) top no-repeat;}<br />
body#products #container-top{<br />
background:url(../images/container-top-products.jpg) top no-repeat;}<br />
body#cart #container-top{<br />
background:url(../images/container-top-cart.jpg) top no-repeat;}</p></blockquote>
<p>Obviously, this is changing the image of #container-top for the various pages. All other properties of container top are set in the initial properties and only the image changes of every page. And <a href="http://www.pillowsanddesigns.com/images/container-top-index.jpg" target="_blank">take a look at the images</a> so you get an idea of what is changing.</p>
<h3>Why do it this way?</h3>
<p>I will not go over the CSS advantages, and if you are reading this article, I assume you use <a href="http://www.tablelesscss.com" target="_blank">CSS tableless builds</a> already since you have already seen the light in CSS. Now why do it this way, using body IDs? And my answer is, why not? If you use plain <em>div</em> tags and image replacement, you will need to create IDs for each one. And often set the height and width for each one. If the website suddenly adds a new page, you create a new <em>div</em> inside with the right ID. Making a global change to these will also be easier doing it this way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.actiononline.biz/web/css-id-used-like-if-statements/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
