<?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; html</title>
	<atom:link href="http://www.swape.net/w/tag/html/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>Swape Gallery Light</title>
		<link>http://www.swape.net/w/2009/08/swape-gallery-light/</link>
		<comments>http://www.swape.net/w/2009/08/swape-gallery-light/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 19:40:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[SGL is a php5 script to list pictures. This script finds all the pictures in a directory under ./test_pic/ and makes menus based on directories. All you have to do is putt your pictures in ./test_pic/ directory. Or edit $strPathToFiles = './test_pic'; in sgl4.class.php file. You can organize your pictures by category, by putting it [...]]]></description>
			<content:encoded><![CDATA[<p>SGL is a php5 script to list pictures.<br />
This script finds all the pictures in a directory under <strong>./test_pic/</strong> and makes menus based on directories.</p>
<p>All you have to do is putt your pictures in <strong>./test_pic/</strong><strong></strong> directory. Or edit <strong>$strPathToFiles = './test_pic';</strong> in <strong>sgl4.class.php</strong> file.</p>
<p>You can organize your pictures by category, by putting it under sub-directories.</p>
<p>The thumbs/ directory must be writable (CHMOD 755) to generate thumbnails automatically first time you visit the site. It will help loading your images faster.</p>
<p><strong>HOW TO INSTALL</strong></p>
<p>All you have to do is unzip the file.<br />
Unpack the <strong>sgl4.php</strong> and configure the paths.</p>
<p>Putt your pictures under <strong>./</strong><strong>test_pic</strong><strong>/</strong> directory.<br />
And don't forget to <em>chmod 755</em> thumbs directory.</p>
<p><strong>SYSTEM REQUIRED.</strong></p>
<p>Server with PHP5.</p>
<p>Download: <a href="http://www.swape.net/w/wp-content/uploads/2009/08/sgl4.zip">sgl4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2009/08/swape-gallery-light/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>favicon2png</title>
		<link>http://www.swape.net/w/2008/02/favicon2png/</link>
		<comments>http://www.swape.net/w/2008/02/favicon2png/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 20:22:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Here is a script to download the favicon.ico files from a website and save it as a png file. You must have imagemagick installed on your server to convert the ico file to png. &#160; &#60;!--- html code ----&#62; &#60;form action=&#34;?&#34; method=&#34;post&#34;&#62; &#160; &#60;input id=&#34;site&#34; name=&#34;site&#34; type=&#34;text&#34; value=&#34;&#60;?php echo $_POST['site']; ?/&#62;&#34; /&#62; &#160; &#60;input type=&#34;submit&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a script to download the favicon.ico files from a website and save it as a png file.</p>
<p>You must have imagemagick installed on your server to convert the ico file to png.</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">&lt;!--- html code ----&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;form action=<span class="st0">&quot;?&quot;</span> method=<span class="st0">&quot;post&quot;</span>&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;input id=<span class="st0">&quot;site&quot;</span> name=<span class="st0">&quot;site&quot;</span> type=<span class="st0">&quot;text&quot;</span></div>
</li>
<li class="li2">
<div class="de2">value=<span class="st0">&quot;&lt;?php echo $_POST['site']; ?/&gt;&quot;</span> /&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;input type=<span class="st0">&quot;submit&quot;</span> /&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;/form&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt; ?php</div>
</li>
<li class="li2">
<div class="de2"><span class="co1">//--- favicon2png by Alireza Balouch @ swape.net 2008</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span> != <span class="st0">''</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">//finding the hostname</span></div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$host</span> = <a href="http://www.php.net/parse_url"><span class="kw3">parse_url</span></a><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$host</span> = <span class="re0">$host</span><span class="br0">&#91;</span><span class="st0">'host'</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$host</span> = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">'.'</span> , <span class="re0">$host</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$host</span> = <span class="re0">$host</span><span class="br0">&#91;</span><a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$host</span><span class="br0">&#41;</span> <span class="nu0">-2</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$filename</span> = <span class="st0">'img/'</span> . <span class="re0">$host</span> . <span class="st0">'.png'</span>;</div>
</li>
<li class="li2">
<div class="de2">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span>!<a href="http://www.php.net/is_file"><span class="kw3">is_file</span></a><span class="br0">&#40;</span><span class="re0">$filename</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="co1">// getting the favicon</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$handle</span> = <a href="http://www.php.net/fopen"><span class="kw3">fopen</span></a><span class="br0">&#40;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span> . <span class="st0">'/favicon.ico'</span>, <span class="st0">&quot;rb&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$contents</span> = stream_get_contents<span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li2">
<div class="de2"><a href="http://www.php.net/fclose"><span class="kw3">fclose</span></a><span class="br0">&#40;</span><span class="re0">$handle</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">file_put_contents<span class="br0">&#40;</span><span class="st0">'fav.ico'</span> , <span class="re0">$contents</span> <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// converting to png</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re0">$StrExec</span> = <span class="st0">'/usr/local/bin/convert fav.ico -resize 24x24<span class="es0">\></span> '</span> . <span class="re0">$filename</span> ;</div>
</li>
<li class="li2">
<div class="de2"><span class="re0">$ret</span> = <a href="http://www.php.net/exec"><span class="kw3">exec</span></a><span class="br0">&#40;</span><span class="re0">$StrExec</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">'&lt;img src=&quot;'</span> . <span class="re0">$filename</span> . <span class="st0">'&quot; /&gt;'</span> . <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st0">'site'</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.swape.net/w/2008/02/favicon2png/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
