<?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>swape.net &#187; Tips &amp; Tricks</title>
	<atom:link href="http://www.swape.net/w/category/tips-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swape.net/w</link>
	<description>alireza balouch</description>
	<lastBuildDate>Wed, 21 Jul 2010 19:00:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>My PHP Code-Standards Part 2</title>
		<link>http://www.swape.net/w/2010/03/my-php-code-standards-part-2/</link>
		<comments>http://www.swape.net/w/2010/03/my-php-code-standards-part-2/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 21:34:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.swape.net/w/?p=85</guid>
		<description><![CDATA[Classses Class name and and file name should have the same name. Let us say you have a class called "myFirstClass" then your file should be myFirstClass.class.php Remember to have some kind of comment on top of the file to describe important information about the class like author, version nr or created date. &#160; class [...]]]></description>
			<content:encoded><![CDATA[<p><b>Classses</b></p>
<p>Class name and and file name should have the same name.</p>
<p>Let us say you have a class called "myFirstClass" then your file should be myFirstClass.class.php </p>
<p>Remember to have some kind of comment on top of the file to describe important information about the class like author, version nr or created date.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> myFirstClass<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intNumber</span> = <span class="nu0">3</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$strName</span> = <span class="st0">''</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">public</span> <span class="kw2">function</span> getNumber<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;<span class="kw1">return</span> <span class="re0">$this</span>-&gt;<span class="me1">intNumber</span> ;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span> </div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>Never access the internal variables directly. Use a public function to get or set the value.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> someClass<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue1</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue2</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> getValue1<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$this</span>-&gt;<span class="me1">intValue1</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> getValue2<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$this</span>-&gt;<span class="me1">intValue2</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
</ol>
</div>
<p>Use default values instead of passing the same value every time.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> someClass<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue1</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">private</span> <span class="re0">$intValue2</span> = <span class="nu0">0</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> <a href="http://www.php.net/getdate"><span class="kw3">getDate</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span> = <span class="st0">'Y-m-d'</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/date"><span class="kw3">date</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<p>Never echo out within a function. It is better to return a value.<br />
This way you can choose what to do with returned value.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$objSome</span> = <span class="kw2">new</span> someClass<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$strReturn</span> = <span class="st0">'Date: &lt;b&gt;'</span> . <span class="re0">$objSome</span>-&gt;<span class="me1">getDate</span><span class="br0">&#40;</span><span class="br0">&#41;</span> . <span class="st0">'&lt;/b&gt;&lt;br/&gt;'</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$strReturn</span> .= <span class="st0">'Week: &lt;b&gt;'</span> . <span class="re0">$objSome</span>-&gt;<span class="me1">getDate</span><span class="br0">&#40;</span><span class="st0">'W'</span><span class="br0">&#41;</span> . <span class="st0">'&lt;/b&gt;'</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="re0">$strReturn</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">class</span> someClass<span class="br0">&#123;</span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> <a href="http://www.php.net/getdate"><span class="kw3">getDate</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span> = <span class="st0">'Y-m-d'</span> <span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <a href="http://www.php.net/date"><span class="kw3">date</span></a><span class="br0">&#40;</span><span class="re0">$strFormat</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2010/03/my-php-code-standards-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My PHP Code-Standards Part 1</title>
		<link>http://www.swape.net/w/2009/11/my-php-code-standards-part-1/</link>
		<comments>http://www.swape.net/w/2009/11/my-php-code-standards-part-1/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 20:35:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Standard]]></category>

		<guid isPermaLink="false">http://www.swape.net/w/?p=5</guid>
		<description><![CDATA[Here is a tutorial on how to write a nice and clean PHP code. Let us start with variables. I use prefix for variables with camel notation. This makes it easy to see and check the right variable for its type. $strName = 'ali' ; $intCounter = 1; $arrData = array&#40;'a'=&#62;'ali' , 'i'=&#62;'is' , 'p'=&#62;'perfect'&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a tutorial on how to write a nice and clean PHP code.</p>
<p>Let us start with variables.</p>
<p>I use prefix for variables with camel notation. This makes it easy to see and check the right variable for its type.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strName</span> = <span class="st0">'ali'</span> ;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$intCounter</span> = <span class="nu0">1</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$arrData</span> = <a href="http://www.php.net/array"><span class="kw3">array</span></a><span class="br0">&#40;</span><span class="st0">'a'</span>=&gt;<span class="st0">'ali'</span> , <span class="st0">'i'</span>=&gt;<span class="st0">'is'</span> , <span class="st0">'p'</span>=&gt;<span class="st0">'perfect'</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$blnTrigger</span> = <span class="kw2">true</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$objMailSender</span> = <span class="kw2">new</span> mailSenderClass<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>I use single quote for my data.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strMyNameIs</span> = <span class="st0">'Alireza'</span>;</div>
</li>
</ol>
</div>
<p>And I use double quotes for SQL or strings that I need to have a single quote inside.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strSQL</span> = <span class="st0">&quot;SELECT * FROM person WHERE name LIKE 'ali' &quot;</span>;</div>
</li>
</ol>
</div>
<p>I never use variable inside a double quote string. I break up the quote.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strCode</span> = <span class="st0">&quot;some $bad code &quot;</span>;<span class="co1">// WRONG AND UGLY</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$strNiceCode</span> = <span class="st0">'Very '</span> . <span class="re0">$strData</span> . <span class="st0">' is pasted here'</span> ;<span class="co1">// NICE CODE</span></div>
</li>
</ol>
</div>
<p>Never ever use short variables like $a or $temp or other lazy short names.<br />
Use variable names that are understandable and describe what it contains.<br />
And using a camelNotation makes it easy to read.<br />
Never start with underscore or other kind of separator for names.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re0">$strReturn</span> = <span class="st0">'Nice code'</span>;</div>
</li>
</ol>
</div>
<p>Only use underscore for constants where you can not use tha camel notation.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><a href="http://www.php.net/define"><span class="kw3">define</span></a><span class="br0">&#40;</span><span class="st0">'FOO_BAR'</span>,<span class="st0">'It works!'</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>And do not start with underscore. There are some other system variables and functions that starts with underscore like <em>_get()</em> or <em>$_SESSION</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/11/my-php-code-standards-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rsync</title>
		<link>http://www.swape.net/w/2009/03/rsync/</link>
		<comments>http://www.swape.net/w/2009/03/rsync/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 21:09:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=27</guid>
		<description><![CDATA[I sync my picture folders and my music and documents to my backup server via rsync. I use ssh on my server. Rsync is fast way of syncing my files. Here is the commend line rsync -vrutzp --exclude=.DS_Store -e &#34;ssh -p 22&#34; /Users/swape/Sites me@myserver.com:/home/mysite I use: (--exclude=.DS_Store) to exclude the mac files (-e "ssh -p [...]]]></description>
			<content:encoded><![CDATA[<p>I sync my picture folders and my music and documents to my backup server via rsync.<br />
I use ssh on my server. Rsync is fast way of syncing my files.</p>
<p>Here is the commend line</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"> rsync -vrutzp --<span class="re2">exclude=</span>.DS_Store -e <span class="st0">&quot;ssh -p 22&quot;</span> /Users/swape/Sites me@myserver.com:/home/mysite</div>
</li>
</ol>
</div>
<p>I use:</p>
<ul>
<li><strong>(--exclude=.DS_Store)</strong> to exclude the mac files</li>
<li><strong>(-e "ssh -p 22") </strong>to use SSH port 22</li>
<li><strong>(/Users/swape/Sites)</strong> my local directory</li>
<li><strong>(me@myserver.com:/home/mysite)</strong> my server</li>
<li><strong>(-v)</strong> verbose mode to see the output</li>
<li><strong>(-r)</strong> recursive into directories</li>
<li><strong>(-u)</strong> using update mode</li>
<li><strong>(-t) </strong>preserve modification times</li>
<li><strong>(-z) </strong>compress file data during the transfer</li>
<li><strong>(-p)</strong> preserve permissions</li>
</ul>
<p>After writing this to my console I enter the password for my server and its done!</p>
<p>This is the fastest way of updating my site from my local disk.<br />
The good thing about this that I use <strong>-u</strong> so it does not upload the files that have not been changed on my local disk. You can also drop the <strong>-v</strong> and make an Automator app but then you have to make the public key for your ssh connection so you don't have to enter the password each time you running the app.</p>
<p>Here is a link to manual on how to make public key <a href="http://sial.org/howto/openssh/publickey-auth/" target="_blank">http://sial.org/howto/openssh/publickey-auth/</a></p>
<p>And this is the rsync manual <a href="http://samba.anu.edu.au/ftp/rsync/rsync.html" target="_blank">http://samba.anu.edu.au/ftp/rsync/rsync.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/03/rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Horizontal menu</title>
		<link>http://www.swape.net/w/2008/05/horizontal-menu/</link>
		<comments>http://www.swape.net/w/2008/05/horizontal-menu/#comments</comments>
		<pubDate>Mon, 12 May 2008 20:04:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://swape.net/w/?p=24</guid>
		<description><![CDATA[Here is an old trick to make horizontal menu with CSS. First you have to make a list with UL and LI tags. &#160; &#60;ul class=&#34;menu&#34;&#62; &#160; &#160; &#60;li&#62;&#60;a href=&#34;http://swape.net&#34;&#62;My homepage&#60;/a&#62;&#60;/li&#62; &#160; &#160; &#60;li&#62;&#60;a href=&#34;http://linux.org&#34;&#62;Linux.org&#60;/a&#62;&#60;/li&#62; &#160; &#160; &#60;li&#62;&#60;a href=&#34;http://google.com&#34;&#62;Link to google&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; &#160; My homepage Linux.org Link to google Ok here is a list. Now we [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an old trick to make horizontal menu with CSS.</p>
<p>First you have to make a list with <strong>UL</strong> and <strong>LI</strong> tags.</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/ul.html"><span class="kw2">&lt;ul</span></a> <span class="kw3">class</span>=<span class="st0">&quot;menu&quot;</span><span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/li.html"><span class="kw2">&lt;li&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://swape.net&quot;</span><span class="kw2">&gt;</span></span>My homepage<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span><span class="sc2"><span class="kw2">&lt;/li&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/li.html"><span class="kw2">&lt;li&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://linux.org&quot;</span><span class="kw2">&gt;</span></span>Linux.org<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span><span class="sc2"><span class="kw2">&lt;/li&gt;</span></span></div>
</li>
<li class="li2">
<div class="de2">&nbsp; &nbsp; <span class="sc2"><a href="http://december.com/html/4/element/li.html"><span class="kw2">&lt;li&gt;</span></a></span><span class="sc2"><a href="http://december.com/html/4/element/a.html"><span class="kw2">&lt;a</span></a> <span class="kw3">href</span>=<span class="st0">&quot;http://google.com&quot;</span><span class="kw2">&gt;</span></span>Link to google<span class="sc2"><span class="kw2">&lt;/a&gt;</span></span><span class="sc2"><span class="kw2">&lt;/li&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><span class="kw2">&lt;/ul&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
</ol>
</div>
<ul>
<li><a href="http://swape.net">My homepage</a></li>
<li><a href="http://linux.org">Linux.org</a></li>
<li><a href="http://google.com">Link to google</a></li>
</ul>
<p>Ok here is a list. Now we must make the list items to be horizontal and not vertical. So we must use CSS to set the<strong> float</strong> to be <strong>left</strong> and make the<strong> list-style: none;</strong></p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.menu</span> li<span class="br0">&#123;</span> <span class="kw1">float</span>: <span class="kw1">left</span>; <span class="kw1">list-style</span>: <span class="kw2">none</span>; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Then we must make them look like a buttons. So we add some borders and padding and margins. Then the whole CSS code look like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.menu</span> li<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">float</span>: <span class="kw1">left</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">list-style</span>: <span class="kw2">none</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">font</span>: <span class="re3">10px</span> Verdana, Arial, Helvetica, <span class="kw2">sans-serif</span>;</div>
</li>
<li class="li2">
<div class="de2"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.menu</span> li a <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">display<span class="re2">:block</span>;</div>
</li>
<li class="li1">
<div class="de1">padding<span class="re2">:<span class="re3">3px</span></span>;</div>
</li>
<li class="li1">
<div class="de1">margin<span class="re2">:<span class="re3">1px</span></span>;</div>
</li>
<li class="li2">
<div class="de2">border<span class="re2">:<span class="re3">1px</span></span> <span class="kw2">solid</span> <span class="re0">#ccc</span>;</div>
</li>
<li class="li1">
<div class="de1">text-decoration<span class="re2">:none</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">color</span>:<span class="re0">#<span class="nu0">332</span></span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-color</span>: <span class="re0">#EEE</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re1">.menu</span> li a<span class="re2">:hover</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">color</span>:<span class="re0">#EEE</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-color</span>: <span class="re0">#<span class="nu0">331</span></span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>You can download the example file here: <a href="http://swape.net/w/wp-content/uploads/2008/05/test.zip">Horizontal CSS menu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/05/horizontal-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checkbox value</title>
		<link>http://www.swape.net/w/2008/04/checkbox-value/</link>
		<comments>http://www.swape.net/w/2008/04/checkbox-value/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 12:06:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When you post a form with checkbox it dose not return any value when the checkbox is not ticked. This is something that should have been fixed a long time ago. But for now here is the solution: &#60;form action=&#34;?&#34; method=&#34;post&#34;&#62; &#60;input name=&#34;myCheckbox&#34; type=&#34;hidden&#34; value=&#34;0&#34; /&#62; &#60;input name=&#34;myCheckbox&#34; type=&#34;checkbox&#34; /&#62; &#60;/form&#62; You put an hidden [...]]]></description>
			<content:encoded><![CDATA[<p>When you post a form with checkbox it dose not return any value when the checkbox is not ticked.<br />
This is something that should have been fixed a long time ago.<br />
But for now here is the solution:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/form.html"><span class="kw2">&lt;form</span></a> <span class="kw3">action</span>=<span class="st0">&quot;?&quot;</span> <span class="kw3">method</span>=<span class="st0">&quot;post&quot;</span><span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">name</span>=<span class="st0">&quot;myCheckbox&quot;</span> <span class="kw3">type</span>=<span class="st0">&quot;hidden&quot;</span> <span class="kw3">value</span>=<span class="st0">&quot;0&quot;</span> /<span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">name</span>=<span class="st0">&quot;myCheckbox&quot;</span> <span class="kw3">type</span>=<span class="st0">&quot;checkbox&quot;</span> /<span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><span class="kw2">&lt;/form&gt;</span></span></div>
</li>
</ol>
</div>
<p>You put an hidden input before checkbox input with the same name.<br />
Since the last checkbox overwrite the value when it is checked, the hidden input do not return "0" but when the checkbox is not checked, the hidden input with the same name returns a "0".</p>
<p>So when the checkbox is checked it returns "on" and when it is not checked it returns "0"</p>
<p>And to make it easier to click on the ckeckbox use "label" tag around the name.</p>
<p>Before:</p>
<div>
<input name="myCheckbox" type="checkbox" /> My Checkbox</div>
<p>After:</p>
<div><label><br />
<input name="myCheckbox" type="checkbox" />My Checkbox</label></div>
<p>This way you can click on the checkbox label and make it checked.<br />
The correct way to write an checkbox checked from the start is like this:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/label.html"><span class="kw2">&lt;label&gt;</span></a></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><a href="http://december.com/html/4/element/input.html"><span class="kw2">&lt;input</span></a> <span class="kw3">checked</span>=<span class="st0">&quot;checked&quot;</span> <span class="kw3">name</span>=<span class="st0">&quot;myCheckbox&quot;</span> <span class="kw3">type</span>=<span class="st0">&quot;checkbox&quot;</span> /<span class="kw2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">My Checkbox</div>
</li>
<li class="li1">
<div class="de1"><span class="sc2"><span class="kw2">&lt;/label&gt;</span></span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/04/checkbox-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semi-transparent png fix in IE6 with CSS</title>
		<link>http://www.swape.net/w/2007/02/semi-transparent-png-fix-in-ie-with-css/</link>
		<comments>http://www.swape.net/w/2007/02/semi-transparent-png-fix-in-ie-with-css/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 20:30:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This example shows how you can show semi-transparent png images in IE and don't mess up the code in other browsers. It uses only CSS and no JavaScript.I use the attribute style to make a style for other browsers then IE. And I'm using the filter style that works only for IE in the normal [...]]]></description>
			<content:encoded><![CDATA[<p>This example shows how you can show semi-transparent png images in IE and don't mess up the code in other browsers. It uses only CSS and no JavaScript.I use the attribute style to make a style for other browsers then IE. And I'm using the <strong>filter</strong> style that works only for IE in the normal section.But first you have to make a semi transparent png image.<br />
Then make an div layer and set a class name "mydiv"</p>
<p>And here is the CSS code:</p>
<div class="dean_ch" style="white-space: wrap;">
<ol>
<li class="li1">
<div class="de1"><span class="re1">.mydiv</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-repeat</span>: <span class="kw2">repeat</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">position</span>: <span class="kw2">relative</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">display</span>: <span class="kw2">block</span>;</div>
</li>
<li class="li2">
<div class="de2">width<span class="re2">:<span class="re3">250px</span></span>;</div>
</li>
<li class="li1">
<div class="de1">height<span class="re2">:<span class="re3">200px</span></span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">text-align</span>: <span class="kw2">center</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* Mozilla Firefox and other non IE based browsers ignores the filter style*/</span></div>
</li>
<li class="li1">
<div class="de1">filter<span class="re2">:progid</span><span class="re2">:DXImageTransform</span><span class="re1">.Microsoft</span><span class="re1">.AlphaImageLoader</span><span class="br0">&#40;</span> enabled=true, sizingMethod=scale src=<span class="st0">&quot;back_g.png&quot;</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">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/* IE ignores this part IE can not read styles with [attribute]*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">.mydiv</span><span class="br0">&#91;</span>class<span class="br0">&#93;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-image</span>: <span class="kw2">url</span><span class="br0">&#40;</span><span class="re4">back_g<span class="re1">.png</span></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">body<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-image</span>: <span class="kw2">url</span><span class="br0">&#40;</span><span class="re4">BG<span class="re1">.png</span></span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">background-repeat</span>: <span class="kw2">repeat</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Since IE can not show semi-transparent png images, we have to use the filter style that only works in ie. But if we use this code we have to make sure that other browsers can show the png file as well. So we use the styles with attributes. And since IE can not read this part, we can put everything that IE dose not need to read there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2007/02/semi-transparent-png-fix-in-ie-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
