<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Neo22s</title>
	
	<link>http://neo22s.com</link>
	<description>Web development, scripts, source code and IT stuff</description>
	<lastBuildDate>Mon, 08 Feb 2010 19:29:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Neo22s" /><feedburner:info uri="neo22s" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Open Classifieds 1.6 Released</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/CC_Djj5U18s/</link>
		<comments>http://neo22s.com/open-classifieds-1-6-released/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 21:17:32 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Open Classifieds]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=892</guid>
		<description><![CDATA[The latest version of Open Classifieds 1.5.4 was released  the 8th of December. Two months later and with more than 11.100 downloads, I&#8217;m proud to release 1.6.
I started working on 1.6 at the ends of 2009 and before the release of today we had two release candidates: RC 1, RC 2. Also I installed RC 2 successfully  in [...]]]></description>
			<content:encoded><![CDATA[<p>The latest version of <a href="http://neo22s.com/open-classifieds-1-5-4-released/">Open Classifieds 1.5.4 was released  the 8th of December</a>. Two months later and with more than <strong>11.100 downloads</strong>, <strong>I&#8217;m proud to release 1.6.</strong></p>
<p>I started <a href="/?p=584">working on 1.6</a> at the ends of 2009 and before the release of today we had two release candidates: <a href="/?p=586">RC 1</a>, <a href="/?p=629">RC 2</a>. Also I installed RC 2 successfully  in a few web sites.</p>
<p>In the upcoming dates we will update all the site FAQs but we already have the <a href="http://open-classifieds.com/forum/forum/16-en">forum</a> and the <a href="http://demo.open-classifieds.com/">demo</a> running.</p>
<p><strong>What&#8217;s new</strong><br />
Just a briefing of what&#8217;s new:</p>
<ul>
<li>Using Db class phpMyDb</li>
<li>Prefix for DB tables</li>
<li>Advanced search</li>
<li>Settings, everything from config.php in a simple form</li>
<li>Now templates can have their own index (listing) and template for items</li>
<li>New themes</li>
<li>New Languages</li>
<li>Check more in readme.txt</li>
</ul>
<p><strong><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.6/Open_Classifieds_1.6.tar.gz/download">Download 1.6 now!</a></strong></p>
<p><strong>How to upgrade from previous versions:</strong></p>
<ul>
<li>Make a backup of your files and DB, just in case</li>
<li>Erase the files form your FTP (<strong>NOT the folder /images/</strong>)</li>
<li>Upload the new files</li>
<li>Run http://yoursite.com/install/</li>
<li>Done</li>
</ul>
<p><a href="http://open-classifieds.com/2010/02/07/open-classifieds-1-6-released/">c&#038;p from Open Classifieds blog</a></p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/CC_Djj5U18s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/open-classifieds-1-6-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/open-classifieds-1-6-released/</feedburner:origLink></item>
		<item>
		<title>Allow only numbers or letters in HTML inputs</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/EVl1Qk77VGs/</link>
		<comments>http://neo22s.com/allow-only-numbers-or-letters-in-html-inputs/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 15:22:42 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=885</guid>
		<description><![CDATA[ 
What about forcing the user to type a number/letter in the input you want. 
With just a bit of JavaScript we can control this what is the user typing int he input.
Allow only numbers:
(also dot and del)

function isNumberKey&#40;evt&#41;&#123;
	var charCode = &#40;evt.which&#41; ? evt.which : event.keyCode;
&#160;
	if&#40;&#40;charCode==46&#124;&#124;charCode==8&#124;&#124;charCode==45&#124;&#124;charCode==47&#41; &#124;&#124;&#40;charCode &#62;= 48 &#38;&#38; charCode &#60;= 57&#41; &#41;&#123;
		return true;
	&#125;
	else [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript" src="http://demo.open-classifieds.com/includes/js/forms.js"></script> </p>
<p>What about forcing the user to type a number/letter in the input you want. </p>
<p>With just a bit of JavaScript we can control this what is the user typing int he input.</p>
<p><strong>Allow only numbers:<br />
</strong>(also dot and del)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> isNumberKey<span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> charCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>evt.<span style="color: #660066;">which</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> evt.<span style="color: #660066;">which</span> <span style="color: #339933;">:</span> event.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">46</span><span style="color: #339933;">||</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">8</span><span style="color: #339933;">||</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">45</span><span style="color: #339933;">||</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">47</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span><span style="color: #009900;">&#40;</span>charCode <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">48</span> <span style="color: #339933;">&amp;&amp;</span> charCode <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">57</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>		
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And to use it in a input would be like this for example:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;math&quot;</span>  <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span>  <span style="color: #000066;">onkeypress</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;return isNumberKey(event);&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p><strong>Try it:</strong> How much is  20+10?<br />
<input id="math"  type="text"  onkeypress="return isNumberKey(event);" />
<p><strong>Allow only letters:<br />
</strong> (also space, del, enter)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> isAlphaKey<span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> charCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>evt.<span style="color: #660066;">which</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> evt.<span style="color: #660066;">which</span> <span style="color: #339933;">:</span> event.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>
	 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">231</span> <span style="color: #339933;">||</span> charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">199</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">241</span> <span style="color: #339933;">||</span> charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">209</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span><span style="color: #009900;">&#40;</span>charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">8</span> <span style="color: #339933;">||</span> charCode<span style="color: #339933;">==</span><span style="color: #CC0000;">32</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>charCode <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">65</span> <span style="color: #339933;">&amp;&amp;</span> charCode <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">90</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>charCode <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">97</span> <span style="color: #339933;">&amp;&amp;</span> charCode <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">122</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	 	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	 <span style="color: #009900;">&#125;</span>
	 <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		 <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And to use it in a input would be like this for example:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;name&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span>  <span style="color: #000066;">onkeypress</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;return isAlphaKey(event);&quot;</span>  <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p><strong>Try it:</strong> Your name:<br />
<input id="name" type="text"  onkeypress="return isAlphaKey(event);"  />
<p>I know should be easier, but just wait a bit for HTML 5 that is going to make our life better. For sure ;)</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/EVl1Qk77VGs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/allow-only-numbers-or-letters-in-html-inputs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/allow-only-numbers-or-letters-in-html-inputs/</feedburner:origLink></item>
		<item>
		<title>Post it Board – HTML Template</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/LtNI2Ba4KcA/</link>
		<comments>http://neo22s.com/post-it-board/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 09:37:58 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=881</guid>
		<description><![CDATA[
Demo &#124; Download &#124; For Open Classifieds
Since I&#8217;m not a web designer, make this templete it&#8217;s been a bit difficult for me.
Why I did it then? easy, I want to learn just a bit of CSS, in order of been able to make my own changes also I had an Idea for a template for [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://lab.neo22s.com/post-it-board/screenshot.png" alt="post it board template HTML" /></p>
<p><strong><a href="http://lab.neo22s.com//post-it-board/">Demo</a> | </strong><a href="http://lab.neo22s.com/post-it-board/post-it-board.zip"><strong>Download</strong></a> | <a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.6/Themes/post-it-board_Open_Classifieds_1.6.tar.gz/download"><strong>For Open Classifieds</strong></a></p>
<p>Since I&#8217;m not a web designer, make this templete it&#8217;s been a bit difficult for me.</p>
<p><strong>Why I did it then?</strong> easy, I want to learn just a bit of CSS, in order of been able to make my own changes also I had an Idea for a template for Open Classifieds but since no one would help me I&#8217;ve decided to do it myself.</p>
<p><strong>I will not normally release this short of things.</strong></p>
<p><del datetime="2010-02-08T19:27:45+00:00">With Open Classifieds 1.6, that is coming really soon, I hope I will have this template ready by then ;) In the meantime please try <a href="http://open-classifieds.com/2010/01/21/open-classifieds-1-6-rc2/">1.6 RC 2</a>.</del></p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/LtNI2Ba4KcA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/post-it-board/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/post-it-board/</feedburner:origLink></item>
		<item>
		<title>Browser support for IE 6 is dead</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/N4vP7H-18tQ/</link>
		<comments>http://neo22s.com/browser-support-for-ie-6-is-dead/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 09:36:40 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=879</guid>
		<description><![CDATA[I hate IE6 as many of you do. Long a go I&#8217;ve decided that my scripts are not going to be tested in ie6 anymore. 
Few webpages they are not longer supporting ie6 and are recommending to change it, to use other browser. But now the giant the &#8220;Big Boss&#8221; Google is doing one step [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://neo22s.com/no-ie6/">hate IE6</a> as many of you do. Long a go I&#8217;ve decided that my scripts are not going to be tested in ie6 anymore. </p>
<p>Few webpages they are not longer supporting ie6 and are recommending to change it, to use other browser. But now the giant the &#8220;Big Boss&#8221; Google is doing one step further to say bye to IE6.</p>
<p>They sent me this email yesterday that I absolutely aprove!<br />
<span id="more-879"></span></p>
<blockquote><p>
Dear Google Apps admin,​</p>
<p>In order to continue to improve our products and deliver more sophisticated features and performance, we are harnessing some of the latest improvements in web browser technology.  This includes faster JavaScript processing and new standards like HTML5.  As a result, over the course of 2010, we will be phasing out support for Microsoft Internet Explorer 6.0 as well as other older browsers that are not supported by their own manufacturers.</p>
<p>We plan to begin phasing out support of these older browsers on the Google Docs suite and the Google Sites editor on March 1, 2010.  After that point, certain functionality within these applications may have higher latency and may not work correctly in these older browsers. Later in 2010, we will start to phase out support for these browsers for Google Mail and Google Calendar.</p>
<p>Google Apps will continue to support Internet Explorer 7.0 and above, Firefox 3.0 and above, Google Chrome 4.0 and above, and Safari 3.0 and above.</p>
<p>Starting next week, users on these older browsers will see a message in Google Docs and the Google Sites editor explaining this change and asking them to upgrade their browser.  We will also alert you again closer to March 1 to remind you of this change.</p>
<p>In 2009, the Google Apps team delivered more than 100 improvements to enhance your product experience.  We are aiming to beat that in 2010 and continue to deliver the best and most innovative collaboration products for businesses.</p>
<p>Thank you for your continued support!</p>
<p>Sincerely,</p>
<p>The Google Apps team
</p></blockquote>
<p>2010 it&#8217;s going to be a better world for web developers ;)</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/N4vP7H-18tQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/browser-support-for-ie-6-is-dead/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://neo22s.com/browser-support-for-ie-6-is-dead/</feedburner:origLink></item>
		<item>
		<title>Input select generated from query – PHP</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/pSNUHslzdJg/</link>
		<comments>http://neo22s.com/input-select-generated-from-query-php/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 23:00:31 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=871</guid>
		<description><![CDATA[Just a handy function that I use a lot.
With this function you can generate an input select from a given query.
Parameters:
1- Query to be displayed as a select, the query needs to returns at least 2 values, 1st one for the option value, and the 2nd one for the display value.
2-Input Select name, thisw woud [...]]]></description>
			<content:encoded><![CDATA[<p>Just a handy function that I use a lot.</p>
<p>With this function you can generate an input select from a given query.</p>
<p>Parameters:<br />
1- Query to be displayed as a select, the query needs to returns at least 2 values, 1st one for the option value, and the 2nd one for the display value.<br />
2-Input Select name, thisw woud be the name that your select will have in the form.<br />
3-Which option it&#8217;s selected from the list. I non is set the first one it&#8217;s selected.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sqlOption<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span><span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//generates a select tag with the values specified on the sql, 2nd parameter name for the combo, , 3rd value selected if there's</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$ocdb</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//1 value needs to be the ID, second the Name, if there's more doens't work</span>
	<span style="color: #000088;">$sqloption</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;select name='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' id='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;
				&lt;option value='0'&gt;Home&lt;/option&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$first</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$second</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$option</span><span style="color: #339933;">==</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$first</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$sel</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;selected=selected&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$sqloption</span><span style="color: #339933;">=</span><span style="color: #000088;">$sqloption</span> <span style="color: #339933;">.</span>  <span style="color: #0000ff;">&quot;&lt;option &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sel</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; value='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$first</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$second</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/option&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$sel</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$sqloption</span><span style="color: #339933;">=</span><span style="color: #000088;">$sqloption</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/select&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$sqloption</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Same function but that can group:<br />
<span id="more-871"></span><br />
Parameters:<br />
1- Query to be displayed as a select, the query needs to returns at least 2 values, 1st one for the option value, the 2nd one for the display value, and 3rd the value we use to group with.<br />
2-Input Select name, thisw woud be the name that your select will have in the form.<br />
3-Which option it&#8217;s selected from the list. I non is set the first one it&#8217;s selected.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sqlOptionGroup<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span><span style="color: #000088;">$name</span><span style="color: #339933;">,</span><span style="color: #000088;">$option</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//generates a select tag with the values specified on the sql, 2nd parameter name for the combo, , 3rd value selected if there's</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$ocdb</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//1 value needs to be the ID, second the Name, 3rd is the group</span>
	<span style="color: #666666; font-style: italic;">//echo $sql;</span>
	<span style="color: #000088;">$sqloption</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;select name='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' id='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' onChange=<span style="color: #000099; font-weight: bold;">\&quot;</span>validateNumber(this);<span style="color: #000099; font-weight: bold;">\&quot;</span> lang=false &gt;&lt;option&gt;&lt;/option&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$lastLabel</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$first</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$second</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$third</span><span style="color: #339933;">=</span> <span style="color: #990000;">mysql_field_name</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lastLabel</span><span style="color: #339933;">!=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$third</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lastLabel</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$sqloption</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;/optgroup&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$sqloption</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;optgroup label='<span style="color: #006699; font-weight: bold;">$row</span>[<span style="color: #006699; font-weight: bold;">$third</span>]'&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$lastLabel</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$third</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$option</span><span style="color: #339933;">==</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$first</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$sel</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;selected=selected&quot;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$sqloption</span><span style="color: #339933;">=</span><span style="color: #000088;">$sqloption</span> <span style="color: #339933;">.</span>  <span style="color: #0000ff;">&quot;&lt;option &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$sel</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; value='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$first</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&quot;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$second</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/option&gt;&quot;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$sel</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$sqloption</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;&lt;/optgroup&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sqloption</span><span style="color: #339933;">=</span><span style="color: #000088;">$sqloption</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/select&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$sqloption</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>NOTE:</strong> Requires <a href="http://neo22s.com/phpmydb/">phpMyDB</a>.</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/pSNUHslzdJg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/input-select-generated-from-query-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/input-select-generated-from-query-php/</feedburner:origLink></item>
		<item>
		<title>Get visitor IP address – PHP</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/KTO85cYnwrg/</link>
		<comments>http://neo22s.com/get-visitor-ip-address-php/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 22:42:47 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=869</guid>
		<description><![CDATA[Simple code of the day:

function getIp&#40;&#41;&#123;//obtain the ip
		// if getenv results in something, proxy detected
		if &#40;getenv&#40;'HTTP_X_FORWARDED_FOR'&#41;&#41; &#123;
			$ip=getenv&#40;'HTTP_X_FORWARDED_FOR'&#41;;
		&#125;
		else &#123;// otherwise no proxy detected
			$ip=getenv&#40;'REMOTE_ADDR'&#41;;
		&#125;
&#160;
		return $ip;
&#125;

Anyway of doing this better?
]]></description>
			<content:encoded><![CDATA[<p>Simple code of the day:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getIp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//obtain the ip</span>
		<span style="color: #666666; font-style: italic;">// if getenv results in something, proxy detected</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTP_X_FORWARDED_FOR'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTP_X_FORWARDED_FOR'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">// otherwise no proxy detected</span>
			<span style="color: #000088;">$ip</span><span style="color: #339933;">=</span><span style="color: #990000;">getenv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$ip</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Anyway of doing this better?</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/KTO85cYnwrg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/get-visitor-ip-address-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://neo22s.com/get-visitor-ip-address-php/</feedburner:origLink></item>
		<item>
		<title>Open Classifieds 1.6 RC2</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/cAmO0MAyKME/</link>
		<comments>http://neo22s.com/open-classifieds-1-6-rc2/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 12:40:58 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Open Classifieds]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=865</guid>
		<description><![CDATA[New Release Candidate for 1.6 now the RC2.
Please DOWNLOAD try / test and give me feed back in the forum for this release.
Open Classifieds 1.6 RC2 demo.
New things:
Fixed many bugs.
addthis instead of the older slower service add to any
Now templates can have their own index (listing) and template for items (check theme gallery-blue to see what I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://open-classifieds.com/2010/01/21/open-classifieds-1-6-rc2/">New Release Candidate for 1.6 now the RC2.</a></p>
<p>Please <a href="http://open-classifieds.com/OpenClassifieds_1.6_RC2.tar.gz">DOWNLOAD</a> try / test and give me feed back in the <a href="http://open-classifieds.com/forum/forum/16-rc-2">forum for this release</a>.</p>
<p><a href="http://open-classifieds.com/rc16/">Open Classifieds 1.6 RC2 demo.</a></p>
<p><strong>New things:</strong></p>
<p>Fixed many bugs.<br />
addthis instead of the older slower service add to any<br />
Now templates can have their own index (listing) and template for items (check theme gallery-blue to see what I mean)<br />
Using j.mp instead of bit.ly to short urls<br />
sort ads by price asc or desc in advanced search<br />
Improved seo now friendly urls for new, contact, sitemap, privacy, advanced search&#8230;</p>
<p><strong>Neeed translation for all languages (except english and spanish):</strong></p>
<pre>
//1.6 new words!
define ("T_SORT","Sort");
define ("T_LINKS","Links");
define ("T_ERROR_CODE","There was a problem with your post. Please do not include code. <a href=\"javascript:history.go(-1)\">Go Back</a>");
define ("T_SPAM_CONTACT","Ups! Spam? if you are not spam contact us.");
define ("T_SPAM","Spam");
define ("T_NO_SPAM","NO Spam!");
define ("T_SPAM_REPORTED","Spam reported");
define ("T_PRIVACY_COUNTRY","Spain");
define ("T_MAP","Map");
define ("T_ADV_SEARCH","Advanced search");
</pre>
<p>Please try and report.</p>
<p>Thanks!</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/cAmO0MAyKME" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/open-classifieds-1-6-rc2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/open-classifieds-1-6-rc2/</feedburner:origLink></item>
		<item>
		<title>PHP Set format date</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/NnV_r628d_w/</link>
		<comments>http://neo22s.com/php-set-format-date/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 09:06:16 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=862</guid>
		<description><![CDATA[Just a function to change the format of a mysql date to the one you want to.

function setDate&#40;$L_date,$L_dateFormat=&#34;dd-mm-yyyy&#34;&#41;&#123;//sets a date in a format
	if&#40;strlen&#40;$L_date&#41;&#62;0&#41;&#123;
		$L_arrTemp = split&#40;&#34; &#34;,$L_date&#41;;
		$L_strDate = $L_arrTemp&#91;0&#93;; // 2007-07-21 year month day
		$L_arrDate = split&#40;&#34;-&#34;,$L_strDate&#41;;// split date 
		$L_strYear =  $L_arrDate&#91;0&#93;;
		$L_strMonth = $L_arrDate&#91;1&#93;;
		$L_strDay = $L_arrDate&#91;2&#93;;
&#160;
		if&#40;$L_dateFormat == 'yyyy-mm-dd'&#41;&#123;//default
		    return $L_arrTemp&#91;0&#93;;
    [...]]]></description>
			<content:encoded><![CDATA[<p>Just a function to change the format of a mysql date to the one you want to.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> setDate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$L_date</span><span style="color: #339933;">,</span><span style="color: #000088;">$L_dateFormat</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;dd-mm-yyyy&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//sets a date in a format</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$L_date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$L_arrTemp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$L_date</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$L_strDate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$L_arrTemp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 2007-07-21 year month day</span>
		<span style="color: #000088;">$L_arrDate</span> <span style="color: #339933;">=</span> <span style="color: #990000;">split</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$L_strDate</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// split date </span>
		<span style="color: #000088;">$L_strYear</span> <span style="color: #339933;">=</span>  <span style="color: #000088;">$L_arrDate</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$L_strMonth</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$L_arrDate</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$L_strDay</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$L_arrDate</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$L_dateFormat</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'yyyy-mm-dd'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//default</span>
		    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$L_arrTemp</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$L_dateFormat</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;dd-mm-yyyy&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//day month year</span>
			<span style="color: #000088;">$returnDate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$L_strDay</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$L_strMonth</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$L_strYear</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$returnDate</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$L_dateFormat</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;mm-dd-yyyy&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//month day year</span>
			<span style="color: #000088;">$returnDate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$L_strMonth</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$L_strDay</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$L_strYear</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$returnDate</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/Neo22s/~4/NnV_r628d_w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/php-set-format-date/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://neo22s.com/php-set-format-date/</feedburner:origLink></item>
		<item>
		<title>Open Classifieds 1.6 RC1</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/2_zYAQJb01I/</link>
		<comments>http://neo22s.com/open-classifieds-1-6-rc1/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 11:54:56 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Open Classifieds]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=855</guid>
		<description><![CDATA[Finally I have the first Release Candidate for 1.6.
Please DOWNLOAD try / test and give me feed back in the forum for this release.
Open Classifieds 1.6 RC1 demo.
Once more the change log for V 1.6 RC1:

Romanian language thank to tutankanon, russian thanks to levgen, italian thanks to paolo
Now languages are in /languages/
Created include controller that [...]]]></description>
			<content:encoded><![CDATA[<p>Finally I have the first <a href="http://open-classifieds.com/2010/01/13/open-classifieds-1-6-rc1/">Release Candidate for 1.6</a>.</p>
<p>Please <a href="http://open-classifieds.com/OpenClassifieds_1.6_RC1.tar.gz">DOWNLOAD</a> try / test and give me feed back in the <a href="http://open-classifieds.com/forum/forum/16-rc-1">forum for this release</a>.</p>
<p><a href="http://open-classifieds.com/rc16/">Open Classifieds 1.6 RC1 demo.</a></p>
<p><strong>Once more the change log for V 1.6 RC1:<br />
</strong><br />
Romanian language thank to tutankanon, russian thanks to levgen, italian thanks to paolo<br />
Now languages are in /languages/<br />
Created include controller that loads the needed data (before was called data.php)<br />
Db class phpMyDb<br />
new cache class integrated with db class<br />
Mark as spam sends to akismet<br />
no install if minimun requirements (PHP > 5 and writable in /includes/)<br />
prefix for db tables (allows you to have more than one install in the same DB)<br />
Adsense deleted, there was problems with google. please donate<br />
Sidebar allows to change theme<br />
config.php define in admin<br />
categories allow duplicates, changes the post slug<br />
advanced search in /search/<br />
fixed few mistakes at sitemap.php</p>
<p>Also it&#8217;s important to check all the themes that are included since there&#8217;s few changes.</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/2_zYAQJb01I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/open-classifieds-1-6-rc1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/open-classifieds-1-6-rc1/</feedburner:origLink></item>
		<item>
		<title>PHP sitemap.xml generator</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/yR8BtsN16kI/</link>
		<comments>http://neo22s.com/php-sitemap-xml-generator/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 23:38:14 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=851</guid>
		<description><![CDATA[Any web page should use a sitemap.xml, it&#8217;s really important for the bots to crawl your site properly.
But how to make it work using PHP?
This is the way I do it for Open Classifieds:
First of all I use to defines, for the path of the file, and when it would expire:

define&#40;SITEMAP_FILE,&#34;sitemap.xml&#34;&#41;;
define&#40;SITEMAP_EXPIRE,3600&#41;; //seconds

At the beginning of [...]]]></description>
			<content:encoded><![CDATA[<p>Any <a href="http://neo22s.com/dont-forget-in-your-web-site/">web page should use a sitemap.xml</a>, it&#8217;s really important for the bots to crawl your site properly.</p>
<p>But how to make it work using PHP?</p>
<p>This is the way I do it for <a href="http://open-classifieds.com/">Open Classifieds</a>:</p>
<p>First of all I use to defines, for the path of the file, and when it would expire:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>SITEMAP_FILE<span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;sitemap.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>SITEMAP_EXPIRE<span style="color: #339933;">,</span><span style="color: #cc66cc;">3600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//seconds</span></pre></div></div>

<p>At the beginning of any of your scripts we check if the sitempa it&#8217;s expired, if it&#8217;s expired we generate another time the sitemap :<br />
<span id="more-851"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span>SITEMAP_FILE<span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span>SITEMAP_EXPIRE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	generateSitemap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// the sitemap is expired then generates it</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then I use this function to generate the file, everytime it&#8217;s needed.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">function generateSitemap(){//generates the sitemap returns the xml
	global $ocdb;
	$file=SITEMAP_FILE;
	$sitemap=&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">'1.0'</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">'UTF-8'</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'
	xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
	xsi:schemaLocation='http://www.sitemaps.org/schemas/sitemap/0.9
			    http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'&gt;&quot;;
&nbsp;
//////////////variable part
//retrieve categories from DB
	$query=&quot;SELECT name,friendlyName,
				(SELECT insertDate FROM &quot;.TABLE_PREFIX.&quot;posts p where idCategory=c.idCategory and isConfirmed=1 order by 1 desc limit 1 ) time
			FROM &quot;.TABLE_PREFIX.&quot;categories c order by idCategoryParent,'order'&quot;;
	$result =	$ocdb-&gt;query($query);
	while ($row=mysql_fetch_assoc($result))
	{
		 $sitemap.=makeUrlTag (SITE_URL.&quot;/category/&quot;.$row['friendlyName'], $row['time'], &quot;hourly&quot;, &quot;0.2&quot;);
	}
//also I add all the posts of course, but for this example it's enough with categories	
//Some manual urls
	$sitemap.=makeUrlTag (SITE_URL.&quot;/rss/&quot;,&quot;&quot;, &quot;hourly&quot;, &quot;0.6&quot;);
	$sitemap.=makeUrlTag (SITE_URL.&quot;/contact/&quot;,&quot;&quot;, &quot;yearly&quot;, &quot;0.6&quot;);
	$sitemap.=makeUrlTag (SITE_URL.&quot;/new/&quot;,&quot;&quot;, &quot;yearly&quot;, &quot;0.6&quot;);
	$sitemap.=makeUrlTag (SITE_URL.&quot;/sitemap/&quot;,&quot;&quot;, &quot;monthly&quot;, &quot;0.6&quot;);
	$sitemap.=makeUrlTag (SITE_URL.&quot;/privacy/&quot;,&quot;&quot;, &quot;monthly&quot;, &quot;0.6&quot;);
//////////////////////////////////////////////////////////////////////////////////
&nbsp;
	$sitemap.=&quot;&lt;/urlset&gt;&quot;;
&nbsp;
	if (file_exists($file))  unlink ($file);
	$file = fopen($file, &quot;w&quot;);
	fwrite($file, $sitemap);
	fclose($file);
&nbsp;
	return $sitemap;
}</pre></div></div>

<p>Also we need this functions that I use from <a href="http://www.smart-it-consulting.com/article.htm?node=133&#038;page=37">smart-it-consulting</a> to make everything work good:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> makeUrlString <span style="color: #009900;">&#40;</span><span style="color: #000088;">$urlString</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">htmlentities</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$urlString</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> makeIso8601TimeStamp <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateTime</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$dateTime</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$dateTime</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d H:i:s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateTime</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">11</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$isoTS</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateTime</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;T&quot;</span>
                 <span style="color: #339933;">.</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateTime</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">11</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;+00:00&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$isoTS</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateTime</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$isoTS</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> makeUrlTag <span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$modifiedDateTime</span><span style="color: #339933;">,</span> <span style="color: #000088;">$changeFrequency</span><span style="color: #339933;">,</span> <span style="color: #000088;">$priority</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">GLOBAL</span> <span style="color: #000088;">$newLine</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">GLOBAL</span> <span style="color: #000088;">$indent</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">GLOBAL</span> <span style="color: #000088;">$isoLastModifiedSite</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$urlOpen</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$indent</span>&lt;url&gt;<span style="color: #006699; font-weight: bold;">$newLine</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$urlValue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$urlClose</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$indent</span>&lt;/url&gt;<span style="color: #006699; font-weight: bold;">$newLine</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$locOpen</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$indent</span><span style="color: #006699; font-weight: bold;">$indent</span>&lt;loc&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$locValue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$locClose</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;/loc&gt;<span style="color: #006699; font-weight: bold;">$newLine</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$lastmodOpen</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$indent</span><span style="color: #006699; font-weight: bold;">$indent</span>&lt;lastmod&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$lastmodValue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$lastmodClose</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;/lastmod&gt;<span style="color: #006699; font-weight: bold;">$newLine</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$changefreqOpen</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$indent</span><span style="color: #006699; font-weight: bold;">$indent</span>&lt;changefreq&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$changefreqValue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$changefreqClose</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;/changefreq&gt;<span style="color: #006699; font-weight: bold;">$newLine</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$priorityOpen</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$indent</span><span style="color: #006699; font-weight: bold;">$indent</span>&lt;priority&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$priorityValue</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$priorityClose</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;/priority&gt;<span style="color: #006699; font-weight: bold;">$newLine</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$urlTag</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$urlOpen</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$urlValue</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$locOpen</span> <span style="color: #339933;">.</span>makeUrlString<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$url</span>&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$locClose</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$modifiedDateTime</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$urlValue</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$lastmodOpen</span> <span style="color: #339933;">.</span>makeIso8601TimeStamp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$modifiedDateTime</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #000088;">$lastmodClose</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$isoLastModifiedSite</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// last modification of web site</span>
         <span style="color: #000088;">$isoLastModifiedSite</span> <span style="color: #339933;">=</span> makeIso8601TimeStamp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$modifiedDateTime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$changeFrequency</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$urlValue</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$changefreqOpen</span> <span style="color: #339933;">.</span><span style="color: #000088;">$changeFrequency</span> <span style="color: #339933;">.</span><span style="color: #000088;">$changefreqClose</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$priority</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$urlValue</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$priorityOpen</span> <span style="color: #339933;">.</span><span style="color: #000088;">$priority</span> <span style="color: #339933;">.</span><span style="color: #000088;">$priorityClose</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$urlTag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$urlValue</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$urlTag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$urlClose</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$urlTag</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And that should be all ;) </p>
<p>Now you can submit your sitemap.xml to the google webmaster tools!</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/yR8BtsN16kI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/php-sitemap-xml-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/php-sitemap-xml-generator/</feedburner:origLink></item>
		<item>
		<title>Ubuntu 9.10 Karmic Koala in Eee PC 1101HA</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/o_YjPNRSYb8/</link>
		<comments>http://neo22s.com/ubuntu-karmic-eeepc/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 19:41:59 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=843</guid>
		<description><![CDATA[Since I bought my beloved Eee PC 1101HA (wonderful screen and battery life), I&#8217;ve been using Ubuntu 9.04, yesterday I&#8217;ve decided to upgrade to Karmic Koala.

When I&#8217;ve installed 9.04, I had problem with the network (wifi and ethernet drivers), and the display drivers. That was all, the rest was great.
When I did the upgrade, the display [...]]]></description>
			<content:encoded><![CDATA[<p>Since I bought my beloved <a href="http://eeepc.asus.com/global/product1101ha.html">Eee PC 1101HA</a> (wonderful screen and battery life), I&#8217;ve been using Ubuntu 9.04, yesterday I&#8217;ve decided to upgrade to Karmic Koala.<br />
<img src="http://rir.li/http://www.liliputing.com/wp-content/uploads/2009/06/eee-pc-1101ha.jpg" alt="Eee PC 1101HA" /></p>
<p>When I&#8217;ve installed <strong>9.04, I had problem with the network (wifi and ethernet drivers), and the display drivers.</strong> That was all, the rest was great.</p>
<p>When I did the upgrade, the display once more was not working properly but the worst was the speed connection, awful.</p>
<p><strong>Then I&#8217;ve decided to do a fresh clean installation:</strong><span id="more-843"></span></p>
<ol>
<li>Download Karmic Koala</li>
<li>Make a pen drive bootable with the app in system-&gt;administration-&gt;Usb Startup Disk Creator</li>
<li>Boot you Eeepc form the pendrive (you can find this in the bios F2-&gt;Boot)</li>
<li>Install Karmic Koala</li>
<li>After this almost everything was working fine but the display and still the internet connection</li>
</ol>
<p>Problems and how I fixed them:</p>
<p><strong>Display resolution:</strong></p>
<p>I found many solutions the easier was <a href="https://wiki.ubuntu.com/HardwareSupportComponentsVideoCardsPoulsbo#karmic">this one</a>:<br />
In command shell:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>gma500re.altervista.org<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>poulsbo_ppa.sh <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> .<span style="color: #000000; font-weight: bold;">/</span>poulsbo_ppa.sh
dpkg-reconfigure psb-kernel-source</pre></div></div>

<p>Restart and works ;)</p>
<p><strong>Internet connection Speed:</strong></p>
<p>There&#8217;s some short of bug that for some weird reason makes your browsing experience really slow. As far as I know (and how I did to solve it) <a href="http://superuser.com/questions/67921/slow-website-loading-on-ubuntu-karmic">it&#8217;s caused by ipv6</a>.</p>
<p>If you use <strong>firefox</strong> you can <a href="http://www.james-blogs.com/2009/11/04/have-you-upgraded-to-ubuntu-9-10-karmic-koala/">use this solution to disable ipv6 only in firefox</a> of course.</p>
<p>Open a firefox browser window and type this in the address bar:</p>
<pre>about:config</pre>
<p>In the filter bar put:</p>
<pre>network.dns.disableIPv6</pre>
<p>You will disable the IPv6 DNS if you set the value to true. Once you have done that close Firefox and then reopen a browser a window. Your internet should be fast again!</p>
<p>But I use Chomium!! and skype&#8230;.then we need to <a href="https://answers.launchpad.net/ubuntu/+question/89485"><strong>disable the module ipv6 to load on start</a> (boot).</strong></p>
<p>Open a terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gksudo gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>grub</pre></div></div>

<p>Look for this line and add:</p>
<pre>GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"</pre>
<p>Save and close your file then run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-grub</pre></div></div>

<p>That&#8217;s all until now&#8230;<strong>seems everything to work pretty good</strong>, just I don&#8217;t like from karmic the new Ubuntu Software Center, I liked more the old one&#8230;</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/o_YjPNRSYb8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/ubuntu-karmic-eeepc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://neo22s.com/ubuntu-karmic-eeepc/</feedburner:origLink></item>
		<item>
		<title>Adiós 2009, Welcome 2010!</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/RvLAy1SsE40/</link>
		<comments>http://neo22s.com/adios-2009-welcome-2010/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 10:15:40 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=835</guid>
		<description><![CDATA[Last day of the year and waiting for a new fresh start ;)
This year was specially fast at least for me. I did many things, that involves many areas from my life, travelling, studying, developing&#8230;
Maybe some of you are interested in what I&#8217;ve done this year:

In February I moved from Holland to Thailand for 5 months.
In [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Last day of the year</strong> and waiting for a new fresh start ;)</p>
<p>This year was specially fast at least for me. <strong>I did many things</strong>, that involves many areas from my life, travelling, studying, developing&#8230;</p>
<p>Maybe some of you are interested in <strong>what I&#8217;ve done this year</strong>:</p>
<ul>
<li>In February I moved from <a href="http://www.deambulando.com/category/holanda/">Holland</a> to <a href="http://www.deambulando.com/category/tailandia/">Thailand</a> for 5 months.</li>
<li>In March I started developing <a href="http://www.open-classifieds.com/">Open Classifieds</a>, just for learning.</li>
<li>I&#8217;ve visited <a href="http://www.deambulando.com/2009/04/08/las-torres-petronas-galeria-de-fotos/">Malaysia</a> , <a href="http://www.deambulando.com/2009/06/02/cosas-vietnamitas/">Vietnam</a>,Liverpool, &#8230;</li>
<li>In July I moved from Thailand back to my home in Barcelona.</li>
<li>I have <a href="http://twitter.com/deambulando">twitter account</a> since July only&#8230;</li>
<li>Since August we have our lovely cat Chang (means elephant in Thai).</li>
<li>In <strong>August I started this blog</strong>, with the forum and the lab ;) (Currently I have 300 unique visitors day)</li>
<li>In September I started English school for first time in my life and it&#8217;s in the official school level 4 of 5.</li>
<li>In October I&#8217;ve quited my work and I started a Software Engineering Master.</li>
<li>I&#8217;ve went to the <a href="http://neo22s.com/php-barcelona-conference-2009/">PHP international conference in Barcelona</a> as Speaker.</li>
<li>I started playing paddle and Ive been defeated twice by my dutch girlfriend :S</li>
</ul>
<p><strong>Goals 2010:</strong></p>
<ul>
<li>Finish my studies successfully.</li>
<li><a href="http://neo22s.com/open-classifieds-2-0-draft/">Release Open Classifieds 2.0</a>.</li>
<li>Visit more and more countries!</li>
<li>Start my own E-business (already working on it).</li>
<li><del datetime="2010-01-04T10:17:10+00:00">Defeat my gf in Paddle, finally</del>.</li>
<li>Learn to use a PHP Framework (Still don&#8217;t know which one).</li>
<li>Learn to relax and take it easy.</li>
<li>Driving license for motorbike (now I can only drive 125cc).</li>
<li>Attend to more conferences, even if I&#8217;m not an Speaker.</li>
<li><del datetime="2009-12-31T10:20:00+00:00">Stop smoking</del> (wait I never smoked!!)</li>
</ul>
<p><strong>BTW, HAPPY NEW YEAR!!!</strong></p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/RvLAy1SsE40" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/adios-2009-welcome-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/adios-2009-welcome-2010/</feedburner:origLink></item>
		<item>
		<title>phpMyDB – Data base class for MySql</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/hv0IHfsm8FY/</link>
		<comments>http://neo22s.com/phpmydb/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 11:02:12 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=824</guid>
		<description><![CDATA[phpMyDB is not only a class handler for MySql written in PHP, it&#8217;s also has a query cache built in, a great debugger and is damn easy to use!
I&#8217;ve wrote this class just few weeks a go since I need it for the new version of Open Classifieds (coming soon I promise, many changes).
This class uses [...]]]></description>
			<content:encoded><![CDATA[<p><strong>phpMyDB is not only a class handler for MySql</strong> written in PHP, it&#8217;s also has a query cache built in, a great debugger and is<strong> damn easy to use!</strong></p>
<p>I&#8217;ve wrote this class just few weeks a go since I need it for the new version of Open Classifieds (coming soon I promise, many changes).</p>
<p>This class uses <a href="http://neo22s.com/filecache/">fileCache</a> class to be able (if you want to) to <strong>cache the query result </strong>in a really simple way (transparent to the programmer).</p>
<p>First <strong><a href="http://lab.neo22s.com/phpMyDB/phpMyDB.zip">Download</a></strong></p>
<p><strong>Usage with examples:</strong></p>
<p><strong>Constructor:</strong><br />
DB Constructor &#8211; connects to the server and selects a database</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> phpMyDB<span style="color: #009900;">&#40;</span>DB_USER<span style="color: #339933;">,</span> DB_PASS<span style="color: #339933;">,</span> DB_NAME<span style="color: #339933;">,</span>DB_HOST<span style="color: #339933;">,</span>DB_CHARSET<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In case of error will print using the private function print_error</p>
<p><strong>Debugger:</strong><br />
Logs all the connection or action inside the class, you can set it on whenever you want.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDebug</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">returnDebug</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We set it on, and at the end of our script(or whenever you want) we should returnDebug, by default in &#8220;HTML&#8221;, but can return as an &#8220;array&#8221;.<br />
Also you can add new &#8220;logs&#8221; with $ocdb->addLog(&#8220;any string&#8221;);</p>
<p><strong>Activate cache:</strong><br />
Uses fileCache class. As parameter we have:<br />
1: true or false to activate or deactivate the cache, by default false<br />
2: Time in seconds by default 3600  (10 seconds expires in the example)<br />
3: Path for the cache, by default cache/</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCache</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Normal query:</strong><br />
Just performs a normal query, but keeps the query counter and logs the action if debugger it&#8217;s on</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #b1b100;">echo</span> 	<span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>getRows</strong><br />
Returns in rows the target query. If cache is activated automatically cache the result as an array.<br />
Parameters:<br />
1: Query to return values<br />
2: Returning as &#8220;assoc&#8221; (default), &#8220;row&#8221; , &#8220;object&#8221; ,&#8221;value&#8221; (returns first field form the query)<br />
3: Cache type &#8220;cache&#8221; or &#8220;APP&#8221; by default &#8220;cache&#8221;<br />
Example: Cached query, returning the row as an object (cache must be activated):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;object&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//more than 1 result</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
           <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><span id="more-824"></span><br />
<strong>getValue</strong><br />
Get value from first value of the query and stores it in the cache.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT count(*) total FROM oc_postshits&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$total_records</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;APP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In the second parameter we can use &#8220;cache&#8221; (default).</p>
<p><strong>Insert:</strong><br />
Insert into,parameters:<br />
1: table + fields<br />
2: values</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;categories (name,friendlyName)&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;'name','fname'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>To get the last id use $ocdb->getLastID();</p>
<p><strong>Update:</strong><br />
Updates table, parameters:<br />
1: table<br />
2: sets<br />
3: where</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;posts&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;isAvailable=0,isConfirmed=0&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;idPost=1 and password='asdsadsad'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Delete:</strong><br />
Delete from, parameters:<br />
1: table<br />
2: where</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">delete</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;categories&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;idCategory=2&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Close db:</strong><br />
Closes DB connection and unsets variables.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">closeDB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Full example:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include</span> <span style="color: #0000ff;">&quot;phpMyDB.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_HOST'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_USER'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_PASS'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'some pass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_NAME'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'openclassifieds'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DB_CHARSET'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ocdb</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> phpMyDB<span style="color: #009900;">&#40;</span>DB_USER<span style="color: #339933;">,</span> DB_PASS<span style="color: #339933;">,</span> DB_NAME<span style="color: #339933;">,</span>DB_HOST<span style="color: #339933;">,</span>DB_CHARSET<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDebug</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCache</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;postshits (idPost,ip)&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;97,'10.0.0.0'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'test insert see id:'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getLastID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT count(*) total FROM oc_posts&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$total_records</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;APP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Total records: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$total_records</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT p.title from oc_posts p Limit 3&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCache</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//cache deactivated</span>
<span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;object&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCache</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//after the query is done activated once more</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//more than 1 result</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$result</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>	
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #666666; font-style: italic;">//if count</span>
<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;nothing found&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">closeDB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">returnDebug</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQueryCounter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' queries generated and '</span><span style="color: #339933;">.</span><span style="color: #000088;">$ocdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getQueryCounter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' queries cached'</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/Neo22s/~4/hv0IHfsm8FY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/phpmydb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://neo22s.com/phpmydb/</feedburner:origLink></item>
		<item>
		<title>Spotify links in Chrome on Gnome/Ubuntu</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/aZ8g5TTtb7Y/</link>
		<comments>http://neo22s.com/spotify-links/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 10:13:21 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[spotify]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=816</guid>
		<description><![CDATA[I like spotify a lot, but was bothering to me a lot that I couldn&#8217;t open the links in Chrome&#8230;
After trying few solutions (for KDE, gnome ), I finally managed to make it work:
First you need to install Spotify in linux
At the console we create this script:

echo '#!/bin/sh' &#62; ~/.browser2spotify
echo 'wine  &#34;$HOME/.wine/drive_c/Program Files/Spotify/spotify.exe&#34; /uri [...]]]></description>
			<content:encoded><![CDATA[<p>I like spotify a lot, but was bothering to me a lot that I couldn&#8217;t open the links in Chrome&#8230;</p>
<p>After trying few solutions (for <a href=" "$HOME/.wine/drive_c/Program Files/Spotify/spotify.exe"">KDE</a>, <a href="http://www.unreliablepollution.net/p/other/how-to-spotify-and-xdg-open">gnome</a> ), I finally managed to make it work:</p>
<p>First you need to <a href="http://www.spotify.com/en/help/faq/wine/">install Spotify in linux</a></p>
<p>At the console we create this script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'#!/bin/sh'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.browser2spotify
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'wine  &quot;$HOME/.wine/drive_c/Program Files/Spotify/spotify.exe&quot; /uri &quot;$@&quot;'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.browser2spotify
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> ~<span style="color: #000000; font-weight: bold;">/</span>.browser2spotify</pre></div></div>

<p>Then we change few options from gnome to know what to do with the url&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">-t</span> string <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>url-handlers<span style="color: #000000; font-weight: bold;">/</span>spotify<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #ff0000;">&quot;/home/USER/.browser2spotify %s&quot;</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>url-handlers<span style="color: #000000; font-weight: bold;">/</span>spotify<span style="color: #000000; font-weight: bold;">/</span>needs_terminal <span style="color: #c20cb9; font-weight: bold;">false</span> <span style="color: #660033;">-t</span> bool
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>url-handlers<span style="color: #000000; font-weight: bold;">/</span>spotify<span style="color: #000000; font-weight: bold;">/</span>enabled <span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #660033;">-t</span> bool</pre></div></div>

<p>Remember to replace the user name in the folder.</p>
<p>That&#8217;s all!</p>
<p>To see if it works, try to open this any from this list:</p>
<p><strong><a target="_blank" href="spotify:user:spotify:playlist:2B2cUq8sJVMHX7HsxC7zmR" >Top 100 2009 PlayList</a></strong><br />
<span id="more-816"></span></p>
<table>
<tbody>
<tr>
<td>1.</td>
<td><strong><a target="_blank" href="spotify:track:70cTMpcgWMcR18t9MRJFjB">I Gotta Feeling</a></strong> by <strong><a target="_blank" href="spotify:artist:1yxSLGMDHlW21z4YXirZDS">Black Eyed Peas</a></strong></td>
<td></td>
</tr>
<tr>
<td>2.</td>
<td><strong><a target="_blank" href="spotify:track:0bVVTWIBqdjHBvYgJVtwXE">Right Round &#8211; Amended Album Version</a></strong> by <strong><a target="_blank" href="spotify:artist:0jnsk9HBra6NMjO2oANoPY">Flo Rida</a></strong></td>
<td></td>
</tr>
<tr>
<td>3.</td>
<td><strong><a target="_blank" href="spotify:track:28O4PwkH8bzARStxeL4pxL">Sexy Bitch (Featuring Akon;explicit)</a></strong> by <strong><a target="_blank" href="spotify:artist:1Cs0zKBU1kc0i8ypK3B9ai">Akon, David Guetta</a></strong></td>
<td></td>
</tr>
<tr>
<td>4.</td>
<td><strong><a target="_blank" href="spotify:track:6w1hZMlo2SVuq29liebhb8">Poker Face</a></strong> by <strong><a target="_blank" href="spotify:artist:1HY2Jd0NmPuamShAr6KMms">Lady Gaga</a></strong></td>
<td></td>
</tr>
<tr>
<td>5.</td>
<td><strong><a target="_blank" href="spotify:track:4JehYebiI9JE8sR8MisGVb">Halo</a></strong> by <strong><a target="_blank" href="spotify:artist:6vWDO969PvNqNYHIOW5v0m">Beyoncé</a></strong></td>
<td></td>
</tr>
<tr>
<td>6.</td>
<td><strong><a target="_blank" href="spotify:track:3QkNkun3dzkeGo1jpkC76S">Use Somebody</a></strong> by <strong><a target="_blank" href="spotify:artist:2qk9voo8llSGYcZ6xrBzKx">Kings Of Leon</a></strong></td>
<td></td>
</tr>
<tr>
<td>7.</td>
<td><strong><a target="_blank" href="spotify:track:0rXgKeO7DWMiXCmNDhkRdd">Boom Boom Pow</a></strong> by <strong><a target="_blank" href="spotify:artist:1yxSLGMDHlW21z4YXirZDS">Black Eyed Peas</a></strong></td>
<td></td>
</tr>
<tr>
<td>8.</td>
<td><strong><a target="_blank" href="spotify:track:2TBwIEhkzVeMQ5bUlDaOlb">Ayo Technology</a></strong> by <strong><a target="_blank" href="spotify:artist:6mo0UbyIvIePdXNyLwQlk5">Milow</a></strong></td>
<td></td>
</tr>
<tr>
<td>9.</td>
<td><strong><a target="_blank" href="spotify:track:619bJQ9uDi8dnXzLebFI7y">When Love Takes Over (Feat.Kelly Rowland)</a></strong> by <strong><a target="_blank" href="spotify:artist:1Cs0zKBU1kc0i8ypK3B9ai">Kelly Rowland, David Guetta</a></strong></td>
<td></td>
</tr>
<tr>
<td>10.</td>
<td><strong><a target="_blank" href="spotify:track:1jJci4qxiYcOHhQR247rEU">Kids</a></strong> by <strong><a target="_blank" href="spotify:artist:0SwO7SWeDHJijQ3XNS7xEE">MGMT</a></strong></td>
<td></td>
</tr>
<tr>
<td>11.</td>
<td><strong><a target="_blank" href="spotify:track:72Odtn9RpwBnSWPeSbyvSm">Man In The Mirror</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson, Andrae Crouch</a></strong></td>
<td></td>
</tr>
<tr>
<td>12.</td>
<td><strong><a target="_blank" href="spotify:track:1mea3bSkSGXuIRvnydlB5b">Viva La Vida</a></strong> by <strong><a target="_blank" href="spotify:artist:4gzpq5DPGxSnKTe4SA8HAU">Coldplay</a></strong></td>
<td></td>
</tr>
<tr>
<td>13.</td>
<td><strong><a target="_blank" href="spotify:track:395C2pn0PdOYPzM4B1jLoO">Sex On Fire</a></strong> by <strong><a target="_blank" href="spotify:artist:2qk9voo8llSGYcZ6xrBzKx">Kings Of Leon</a></strong></td>
<td></td>
</tr>
<tr>
<td>14.</td>
<td><strong><a target="_blank" href="spotify:track:1FKxKGONukVFXWVJxAKmlz">Sweet Dreams</a></strong> by <strong><a target="_blank" href="spotify:artist:6vWDO969PvNqNYHIOW5v0m">Beyoncé</a></strong></td>
<td></td>
</tr>
<tr>
<td>15.</td>
<td><strong><a target="_blank" href="spotify:track:0TuTx2Gwtfrt769k4sJRgh">If I Were A Boy</a></strong> by <strong><a target="_blank" href="spotify:artist:6vWDO969PvNqNYHIOW5v0m">Beyoncé</a></strong></td>
<td></td>
</tr>
<tr>
<td>16.</td>
<td><strong><a target="_blank" href="spotify:track:5tb91XZX6dbjwMTB9TDw97">We Made You &#8211; Single Version</a></strong> by <strong><a target="_blank" href="spotify:artist:7dGJo4pcD2V6oG8kP0tJRR">Eminem</a></strong></td>
<td></td>
</tr>
<tr>
<td>17.</td>
<td><strong><a target="_blank" href="spotify:track:64yrDBpcdwEdNY9loyEGbX">21 Guns</a></strong> by <strong><a target="_blank" href="spotify:artist:7oPftvlwr6VrsViSDV7fJY">Green Day</a></strong></td>
<td></td>
</tr>
<tr>
<td>18.</td>
<td><strong><a target="_blank" href="spotify:track:6hTcRuSaaTNwlyIYkkMpWX">Infinity 2008 &#8211; Klaas Vocal Edit</a></strong> by <strong><a target="_blank" href="spotify:artist:4ME85YvMUi1hdqhbind7gy">Guru Josh Project</a></strong></td>
<td></td>
</tr>
<tr>
<td>19.</td>
<td><strong><a target="_blank" href="spotify:track:3WggV4HBM6ZIZHgryyKKmm">Fix You</a></strong> by <strong><a target="_blank" href="spotify:artist:4gzpq5DPGxSnKTe4SA8HAU">Coldplay</a></strong></td>
<td></td>
</tr>
<tr>
<td>20.</td>
<td><strong><a target="_blank" href="spotify:track:3ZlFUr0RBrUYYsmlcFvD0e">Paper Planes</a></strong> by <strong><a target="_blank" href="spotify:artist:1QLoe4M9MBhNEQzOnpO9t5">M.I.A.</a></strong></td>
<td></td>
</tr>
<tr>
<td>21.</td>
<td><strong><a target="_blank" href="spotify:track:2PBOI7vYicqDaG9rYbycUO">Not Fair</a></strong> by <strong><a target="_blank" href="spotify:artist:13saZpZnCDWOI9D4IJhp1f">Lily Allen</a></strong></td>
<td></td>
</tr>
<tr>
<td>22.</td>
<td><strong><a target="_blank" href="spotify:track:3KzBxXbF2tc01LeKu1uIMM">Live Your Life &#8211; Explicit Album Version</a></strong> by <strong><a target="_blank" href="spotify:artist:4OBJLual30L7gRl5UkeRcT">T.I.</a></strong></td>
<td></td>
</tr>
<tr>
<td>23.</td>
<td><strong><a target="_blank" href="spotify:track:7Fv96yqjGTHJCgRuBRrOeO">Love Story</a></strong> by <strong><a target="_blank" href="spotify:artist:06HL4z0CvFAxyc27GXpf02">Taylor Swift</a></strong></td>
<td></td>
</tr>
<tr>
<td>24.</td>
<td><strong><a target="_blank" href="spotify:track:1mzn6CQ71eUmgCSfbVmicN">Smooth Criminal (Radio Edit)</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson</a></strong></td>
<td></td>
</tr>
<tr>
<td>25.</td>
<td><strong><a target="_blank" href="spotify:track:5P6dk8y40cCgHcWtPwF3N3">Losing You</a></strong> by <strong><a target="_blank" href="spotify:artist:4XQZzpMWIuQ266ixFHQkrI">Dead by April</a></strong></td>
<td></td>
</tr>
<tr>
<td>26.</td>
<td><strong><a target="_blank" href="spotify:track:4rqR0yM2k41leqyErhNzTs">Beautiful</a></strong> by <strong><a target="_blank" href="spotify:artist:0z4gvV4rjIZ9wHck67ucSV">Akon, Colby O’Donis, Kardinal Offishall</a></strong></td>
<td></td>
</tr>
<tr>
<td>27.</td>
<td><strong><a target="_blank" href="spotify:track:32yIEFS62uS5ryhr2Xlooj">Hotel Room Service</a></strong> by <strong><a target="_blank" href="spotify:artist:0TnOYISbd1XYRBk9myaseg">Pitbull, Jim Jonsin</a></strong></td>
<td></td>
</tr>
<tr>
<td>28.</td>
<td><strong><a target="_blank" href="spotify:track:0eH2eHURaXUP15D8gQlfjx">LoveGame</a></strong> by <strong><a target="_blank" href="spotify:artist:1HY2Jd0NmPuamShAr6KMms">Lady Gaga</a></strong></td>
<td></td>
</tr>
<tr>
<td>29.</td>
<td><strong><a target="_blank" href="spotify:track:3TbUO5qw7OA33yyYpeCWrJ">Dead And Gone [feat. Justin Timberlake] &#8211; Explicit Album Version</a></strong> by <strong><a target="_blank" href="spotify:artist:4OBJLual30L7gRl5UkeRcT">T.I.</a></strong></td>
<td></td>
</tr>
<tr>
<td>30.</td>
<td><strong><a target="_blank" href="spotify:track:5IxUJIYiwfkwa9Q2hMcNxm">Svennebanan</a></strong> by <strong><a target="_blank" href="spotify:artist:6tbXwhqy3WAFqanusCLvEU">Promoe</a></strong></td>
<td></td>
</tr>
<tr>
<td>31.</td>
<td><strong><a target="_blank" href="spotify:track:7gDKfEMIhyyO4asgEXwcrs">Fire Burning</a></strong> by <strong><a target="_blank" href="spotify:artist:6S0dmVVn4udvppDhZIWxCr">Sean Kingston, RedOne</a></strong></td>
<td></td>
</tr>
<tr>
<td>32.</td>
<td><strong><a target="_blank" href="spotify:track:3Z8cX6y0SeJIsI3yxoaQ8K">Closer</a></strong> by <strong><a target="_blank" href="spotify:artist:2qk9voo8llSGYcZ6xrBzKx">Kings Of Leon</a></strong></td>
<td></td>
</tr>
<tr>
<td>33.</td>
<td><strong><a target="_blank" href="spotify:track:0BCPKOYdS2jbQ8iyB56Zns">Clocks</a></strong> by <strong><a target="_blank" href="spotify:artist:4gzpq5DPGxSnKTe4SA8HAU">Coldplay</a></strong></td>
<td></td>
</tr>
<tr>
<td>34.</td>
<td><strong><a target="_blank" href="spotify:track:02XnQdf7sipaKBBHixz3Zp">Paparazzi</a></strong> by <strong><a target="_blank" href="spotify:artist:1HY2Jd0NmPuamShAr6KMms">Lady Gaga</a></strong></td>
<td></td>
</tr>
<tr>
<td>35.</td>
<td><strong><a target="_blank" href="spotify:track:6xoR54qAPRbY934G8d8vtY">Knock You Down</a></strong> by <strong><a target="_blank" href="spotify:artist:63wjoROpeh5f11Qm93UiJ1">Kanye West, Keri Hilson, Ne-Yo</a></strong></td>
<td></td>
</tr>
<tr>
<td>36.</td>
<td><strong><a target="_blank" href="spotify:track:0leJr3UNvxrXqrwgE8v0ps">Human</a></strong> by <strong><a target="_blank" href="spotify:artist:0C0XlULifJtAgn6ZNCW2eu">The Killers</a></strong></td>
<td></td>
</tr>
<tr>
<td>37.</td>
<td><strong><a target="_blank" href="spotify:track:0IZM2onaTBMRTEIcc5oIi9">Hot N Cold</a></strong> by <strong><a target="_blank" href="spotify:artist:6jJ0s89eD6GaHleKKya26X">Katy Perry</a></strong></td>
<td></td>
</tr>
<tr>
<td>38.</td>
<td><strong><a target="_blank" href="spotify:track:3WUbVS0J4Ulf0XZR6LNRnh">Eh, Eh (Nothing Else I Can Say)</a></strong> by <strong><a target="_blank" href="spotify:artist:1HY2Jd0NmPuamShAr6KMms">Lady Gaga</a></strong></td>
<td></td>
</tr>
<tr>
<td>39.</td>
<td><strong><a target="_blank" href="spotify:track:0Ketr9du9SbrbfpgBYe0SL">Mayhem</a></strong> by <strong><a target="_blank" href="spotify:artist:7yjQSKM1rBSYbUOTtPKF8j">Lorentz &amp; M.Sakarias</a></strong></td>
<td></td>
</tr>
<tr>
<td>40.</td>
<td><strong><a target="_blank" href="spotify:track:59wpu37k02o2UGZIPpcSPd">Jai Ho! (You Are My Destiny)</a></strong> by <strong><a target="_blank" href="spotify:artist:6wPhSqRtPu1UhRCDX5yaDJ">A.R. Rahman, The Pussycat Dolls, Nicole Scherzinger</a></strong></td>
<td></td>
</tr>
<tr>
<td>41.</td>
<td><strong><a target="_blank" href="spotify:track:03yc0G2OoH1Eeyu7Piy8fK">I’m Yours</a></strong> by <strong><a target="_blank" href="spotify:artist:4phGZZrJZRo4ElhRtViYdl">Jason Mraz</a></strong></td>
<td></td>
</tr>
<tr>
<td>42.</td>
<td><strong><a target="_blank" href="spotify:track:5YAY2D4s3o0QNOpFwEsynX">Black Or White</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson</a></strong></td>
<td></td>
</tr>
<tr>
<td>43.</td>
<td><strong><a target="_blank" href="spotify:track:53gcDgFyqqpvCzXWrnFZpH">Heartless</a></strong> by <strong><a target="_blank" href="spotify:artist:5K4W6rqBFWDnAN6FQUkS6x">Kanye West</a></strong></td>
<td></td>
</tr>
<tr>
<td>44.</td>
<td><strong><a target="_blank" href="spotify:track:7n8UWYTawkrcC1KBsY5XRc">Beautiful</a></strong> by <strong><a target="_blank" href="spotify:artist:7dGJo4pcD2V6oG8kP0tJRR">Eminem</a></strong></td>
<td></td>
</tr>
<tr>
<td>45.</td>
<td><strong><a target="_blank" href="spotify:track:5st5644IlBmKiiRE73UsoZ">Fuck You</a></strong> by <strong><a target="_blank" href="spotify:artist:13saZpZnCDWOI9D4IJhp1f">Lily Allen</a></strong></td>
<td></td>
</tr>
<tr>
<td>46.</td>
<td><strong><a target="_blank" href="spotify:track:5g2GVm8NFACpKl2F2OWXwA">When It Was Good</a></strong> by <strong><a target="_blank" href="spotify:artist:6S9rh06VCCIYEvYMFnVMVN">Flipsyde</a></strong></td>
<td></td>
</tr>
<tr>
<td>47.</td>
<td><strong><a target="_blank" href="spotify:track:75JFxkI2RXiU7L9VXzMkle">The Scientist</a></strong> by <strong><a target="_blank" href="spotify:artist:4gzpq5DPGxSnKTe4SA8HAU">Coldplay</a></strong></td>
<td></td>
</tr>
<tr>
<td>48.</td>
<td><strong><a target="_blank" href="spotify:track:4iG2gAwKXsOcijVaVXzRPW">Time To Pretend</a></strong> by <strong><a target="_blank" href="spotify:artist:0SwO7SWeDHJijQ3XNS7xEE">MGMT</a></strong></td>
<td></td>
</tr>
<tr>
<td>49.</td>
<td><strong><a target="_blank" href="spotify:track:4WcCW10tnJCljX8Fhs0FdE">She Wolf</a></strong> by <strong><a target="_blank" href="spotify:artist:0EmeFodog0BfCgMzAIvKQp">Shakira</a></strong></td>
<td></td>
</tr>
<tr>
<td>50.</td>
<td><strong><a target="_blank" href="spotify:track:6li2D8wQPvgwI2QIrGPhAF">My Life Would Suck Without You</a></strong> by <strong><a target="_blank" href="spotify:artist:3BmGtnKgCSGYIUhmivXKWX">Kelly Clarkson</a></strong></td>
<td></td>
</tr>
<tr>
<td>51.</td>
<td><strong><a target="_blank" href="spotify:track:69yVxyuRahEzs2taFMVVoO">Empire State Of Mind [Jay-Z + Alicia Keys] &#8211; Explicit Album Version</a></strong> by <strong><a target="_blank" href="spotify:artist:3nFkdlSjzX9mRTtwJOzDYB">Jay-Z</a></strong></td>
<td></td>
</tr>
<tr>
<td>52.</td>
<td><strong><a target="_blank" href="spotify:track:06T10fEzN8ZCcqzQZYA184">Gotta Be Somebody</a></strong> by <strong><a target="_blank" href="spotify:artist:6deZN1bslXzeGvOLaLMOIF">Nickelback</a></strong></td>
<td></td>
</tr>
<tr>
<td>53.</td>
<td><strong><a target="_blank" href="spotify:track:05cLHUb65Na1jBi9KC2oUT">Free Fallin’ &#8211; Live at the Nokia Theatre</a></strong> by <strong><a target="_blank" href="spotify:artist:0hEurMDQu99nJRq8pTxO14">John Mayer</a></strong></td>
<td></td>
</tr>
<tr>
<td>54.</td>
<td><strong><a target="_blank" href="spotify:track:0jVmQ616tYw60y7yqwO9FV">Billie Jean &#8211; Single Version</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson</a></strong></td>
<td></td>
</tr>
<tr>
<td>55.</td>
<td><strong><a target="_blank" href="spotify:track:2hubQyLihYSKOeI01mS3vn">Dirty Diana</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson</a></strong></td>
<td></td>
</tr>
<tr>
<td>56.</td>
<td><strong><a target="_blank" href="spotify:track:3HSerBi92GxDcB3rWm3epr">Rap Das Armas &#8211; Lucana Radio Edit</a></strong> by <strong><a target="_blank" href="spotify:artist:2rwHPBK5IvPCDr0QjKlgQc">Cidinho &amp; Doca</a></strong></td>
<td></td>
</tr>
<tr>
<td>57.</td>
<td><strong><a target="_blank" href="spotify:track:77NNZQSqzLNqh2A9JhLRkg">Don’t Stop Believin’</a></strong> by <strong><a target="_blank" href="spotify:artist:0rvjqX7ttXeg3mTy8Xscbt">Journey</a></strong></td>
<td></td>
</tr>
<tr>
<td>58.</td>
<td><strong><a target="_blank" href="spotify:track:7aE1vrBiMH5CNQj7uvt3X3">Womanizer &#8211; Main Version</a></strong> by <strong><a target="_blank" href="spotify:artist:26dSoYclwsYLMAKD3tpOr4">Britney Spears</a></strong></td>
<td></td>
</tr>
<tr>
<td>59.</td>
<td><strong><a target="_blank" href="spotify:track:6VCqx14OVaX9uwSvC0PvAG">The Girl And The Robot</a></strong> by <strong><a target="_blank" href="spotify:artist:5nPOO9iTcrs9k6yFffPxjH">Röyksopp</a></strong></td>
<td></td>
</tr>
<tr>
<td>60.</td>
<td><strong><a target="_blank" href="spotify:track:5M8nEsWqUkwUwCp58ydE4W">Run This Town [Jay-Z + Rihanna + Kanye West] &#8211; Explicit Album Version</a></strong> by <strong><a target="_blank" href="spotify:artist:3nFkdlSjzX9mRTtwJOzDYB">Jay-Z</a></strong></td>
<td></td>
</tr>
<tr>
<td>61.</td>
<td><strong><a target="_blank" href="spotify:track:0upQ8bgqXGhFsBgvchxbGm">Love Sex Magic &#8211; Main Version</a></strong> by <strong><a target="_blank" href="spotify:artist:6bnBYEmvxHNrDGRBsOd4yJ">Ciara featuring Justin Timberlake</a></strong></td>
<td></td>
</tr>
<tr>
<td>62.</td>
<td><strong><a target="_blank" href="spotify:track:6L89mwZXSOwYl76YXfX13s">Basket Case</a></strong> by <strong><a target="_blank" href="spotify:artist:7oPftvlwr6VrsViSDV7fJY">Green Day</a></strong></td>
<td></td>
</tr>
<tr>
<td>63.</td>
<td><strong><a target="_blank" href="spotify:track:3K8ErhGR5lZgGCdmvv4UDU">Crack A Bottle &#8211; Edited Version</a></strong> by <strong><a target="_blank" href="spotify:artist:7dGJo4pcD2V6oG8kP0tJRR">Eminem, Dr. Dre, 50 Cent</a></strong></td>
<td></td>
</tr>
<tr>
<td>64.</td>
<td><strong><a target="_blank" href="spotify:track:4UJt3Ipg45AqLdaSvejmNg">The Fear</a></strong> by <strong><a target="_blank" href="spotify:artist:13saZpZnCDWOI9D4IJhp1f">Lily Allen</a></strong></td>
<td></td>
</tr>
<tr>
<td>65.</td>
<td><strong><a target="_blank" href="spotify:track:4OSRg1faLprPCt86C80zWt">Ambitions</a></strong> by <strong><a target="_blank" href="spotify:artist:0UACE2nWl5uUyJRo1kIYQO">Donkeyboy</a></strong></td>
<td></td>
</tr>
<tr>
<td>66.</td>
<td><strong><a target="_blank" href="spotify:track:1dzQoRqT5ucxXVaAhTcT0J">Just Dance</a></strong> by <strong><a target="_blank" href="spotify:artist:1HY2Jd0NmPuamShAr6KMms">Colby O’Donis, Lady Gaga</a></strong></td>
<td></td>
</tr>
<tr>
<td>67.</td>
<td><strong><a target="_blank" href="spotify:track:6SpLc7EXZIPpy0sVko0aoU">Misery Business</a></strong> by <strong><a target="_blank" href="spotify:artist:74XFHRwlV6OrjEM0A2NCMF">Paramore</a></strong></td>
<td></td>
</tr>
<tr>
<td>68.</td>
<td><strong><a target="_blank" href="spotify:track:5Mhmb7EJiUVF55qtsKvVHK">Keep You Much Longer</a></strong> by <strong><a target="_blank" href="spotify:artist:0z4gvV4rjIZ9wHck67ucSV">Akon</a></strong></td>
<td></td>
</tr>
<tr>
<td>69.</td>
<td><strong><a target="_blank" href="spotify:track:7MzmBmyI9KkyQJaPNLdtUi">17 år</a></strong> by <strong><a target="_blank" href="spotify:artist:2OIWxN9xUhgUHkeUCWCaNs">Veronica Maggio</a></strong></td>
<td></td>
</tr>
<tr>
<td>70.</td>
<td><strong><a target="_blank" href="spotify:track:6NVvx94mxobf4u6FJX9l9T">Mockingbird</a></strong> by <strong><a target="_blank" href="spotify:artist:7dGJo4pcD2V6oG8kP0tJRR">Eminem</a></strong></td>
<td></td>
</tr>
<tr>
<td>71.</td>
<td><strong><a target="_blank" href="spotify:track:6i24LdtpurY1OPvRVjNsSH">Let It Rock</a></strong> by <strong><a target="_blank" href="spotify:artist:4UhjD0E3vXBAE4l36QyVlx">Kevin Rudolf, Lil Wayne</a></strong></td>
<td></td>
</tr>
<tr>
<td>72.</td>
<td><strong><a target="_blank" href="spotify:track:2QXQ9BrS8bmfKYbHuuYkkS">In For The Kill</a></strong> by <strong><a target="_blank" href="spotify:artist:3K2zB87GZv1krx031en5VA">La Roux</a></strong></td>
<td></td>
</tr>
<tr>
<td>73.</td>
<td><strong><a target="_blank" href="spotify:track:41SJCRqUG2lAFtfR6MJ8mm">How You Remind Me &#8211; LP Mix</a></strong> by <strong><a target="_blank" href="spotify:artist:6deZN1bslXzeGvOLaLMOIF">Nickelback</a></strong></td>
<td></td>
</tr>
<tr>
<td>74.</td>
<td><strong><a target="_blank" href="spotify:track:3AJwUDP919kvQ9QcozQPxg">Yellow</a></strong> by <strong><a target="_blank" href="spotify:artist:4gzpq5DPGxSnKTe4SA8HAU">Coldplay</a></strong></td>
<td></td>
</tr>
<tr>
<td>75.</td>
<td><strong><a target="_blank" href="spotify:track:7IjdIp3WlQtEnN2BXjr7ov">The Kids Aren’t Alright</a></strong> by <strong><a target="_blank" href="spotify:artist:5LfGQac0EIXyAN8aUwmNAQ">The Offspring</a></strong></td>
<td></td>
</tr>
<tr>
<td>76.</td>
<td><strong><a target="_blank" href="spotify:track:0nDqJMKcSTtYlGK6OQ3sLC">Kiss Me Thru The Phone</a></strong> by <strong><a target="_blank" href="spotify:artist:49pNW7BpR7N25ikqYFgH4C">Soulja Boy Tell`em, Sammie</a></strong></td>
<td></td>
</tr>
<tr>
<td>77.</td>
<td><strong><a target="_blank" href="spotify:track:0kO3njY9N1Rxgv27Ha1lLh">Numb</a></strong> by <strong><a target="_blank" href="spotify:artist:6XyY86QOPPrYVGvF9ch6wz">Linkin Park</a></strong></td>
<td></td>
</tr>
<tr>
<td>78.</td>
<td><strong><a target="_blank" href="spotify:track:7cx6hiNiJIcSNfFZYW5fsQ">Don’t Stop Me Now</a></strong> by <strong><a target="_blank" href="spotify:artist:1dfeR4HaWDbWqFHLkxsg1d">Queen</a></strong></td>
<td></td>
</tr>
<tr>
<td>79.</td>
<td><strong><a target="_blank" href="spotify:track:2nPXRL8SX00vl9zeQHMSQp">I Want You Back</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson, Jackson 5</a></strong></td>
<td></td>
</tr>
<tr>
<td>80.</td>
<td><strong><a target="_blank" href="spotify:track:75dHnNDDenNLCUwU1Shvcj">Sugar &#8211; feat. Wynter</a></strong> by <strong><a target="_blank" href="spotify:artist:0jnsk9HBra6NMjO2oANoPY">Flo Rida</a></strong></td>
<td></td>
</tr>
<tr>
<td>81.</td>
<td><strong><a target="_blank" href="spotify:track:1r1eut6GuXFFDbX0vd9NPv">Bulletproof</a></strong> by <strong><a target="_blank" href="spotify:artist:3K2zB87GZv1krx031en5VA">La Roux</a></strong></td>
<td></td>
</tr>
<tr>
<td>82.</td>
<td><strong><a target="_blank" href="spotify:track:3eag3qvx1Cwsn1ABAN4otn">Battlefield &#8211; Main Version</a></strong> by <strong><a target="_blank" href="spotify:artist:2AQjGvtT0pFYfxR3neFcvz">Jordin Sparks</a></strong></td>
<td></td>
</tr>
<tr>
<td>83.</td>
<td><strong><a target="_blank" href="spotify:track:75lONKZNhv4bvUxiwzKxIc">Dance With Somebody &#8211; Radio Version</a></strong> by <strong><a target="_blank" href="spotify:artist:5I4eibDkC7gg0hmczTZuND">Mando Diao</a></strong></td>
<td></td>
</tr>
<tr>
<td>84.</td>
<td><strong><a target="_blank" href="spotify:track:0e9yNhxYfJul6sQ8Cizr1B">The Climb</a></strong> by <strong><a target="_blank" href="spotify:artist:5YGY8feqx7naU7z4HrwZM6">Miley Cyrus</a></strong></td>
<td></td>
</tr>
<tr>
<td>85.</td>
<td><strong><a target="_blank" href="spotify:track:4hy4fb5D1KL50b3sng9cjw">Smells Like Teen Spirit</a></strong> by <strong><a target="_blank" href="spotify:artist:6olE6TJLqED3rqDCT0FyPh">Nirvana</a></strong></td>
<td></td>
</tr>
<tr>
<td>86.</td>
<td><strong><a target="_blank" href="spotify:track:4BbxSTDqfnX76DtwZLHuJb">The Boy Does Nothing</a></strong> by <strong><a target="_blank" href="spotify:artist:5jLwURKdEPDvuYnac74s9c">Alesha Dixon</a></strong></td>
<td></td>
</tr>
<tr>
<td>87.</td>
<td><strong><a target="_blank" href="spotify:track:2ygaLrZRz3rSrghhlv0sSN">Supernova</a></strong> by <strong><a target="_blank" href="spotify:artist:1zV9UjTUevjp5VUddqIUUn">Mr Hudson, Kanye West</a></strong></td>
<td></td>
</tr>
<tr>
<td>88.</td>
<td><strong><a target="_blank" href="spotify:track:0vJCPCKymBZJqcFqSMxLFM">Rockstar</a></strong> by <strong><a target="_blank" href="spotify:artist:6deZN1bslXzeGvOLaLMOIF">Nickelback</a></strong></td>
<td></td>
</tr>
<tr>
<td>89.</td>
<td><strong><a target="_blank" href="spotify:track:3FtYbEfBqAlGO46NUDQSAt">Electric Feel</a></strong> by <strong><a target="_blank" href="spotify:artist:0SwO7SWeDHJijQ3XNS7xEE">MGMT</a></strong></td>
<td></td>
</tr>
<tr>
<td>90.</td>
<td><strong><a target="_blank" href="spotify:track:3xKUTwzJKRYtbPWN6oQxXq">I Know You Want Me [Calle Ocho] &#8211; Radio Edit</a></strong> by <strong><a target="_blank" href="spotify:artist:0TnOYISbd1XYRBk9myaseg">Pitbull</a></strong></td>
<td></td>
</tr>
<tr>
<td>91.</td>
<td><strong><a target="_blank" href="spotify:track:4dPFAbEvx9GscqsDICUg96">Hurtful</a></strong> by <strong><a target="_blank" href="spotify:artist:1K65R5zY4i7esTh3cX1Bfi">Erik Hassle</a></strong></td>
<td></td>
</tr>
<tr>
<td>92.</td>
<td><strong><a target="_blank" href="spotify:track:71J35WJeJJKTg9WNTya0pf">Summer Of ‘69</a></strong> by <strong><a target="_blank" href="spotify:artist:3Z02hBLubJxuFJfhacLSDc">Bryan Adams</a></strong></td>
<td></td>
</tr>
<tr>
<td>93.</td>
<td><strong><a target="_blank" href="spotify:track:5j0OkRN4KRzVeSfY63buDe">Down</a></strong> by <strong><a target="_blank" href="spotify:artist:3Z02hBLubJxuFJfhacLSDc">Jay Sean, Lil Wayne</a></strong></td>
<td></td>
</tr>
<tr>
<td>94.</td>
<td><strong><a target="_blank" href="spotify:track:3GvCywrlMlMQX7aEd2fRTP">Om du lämnade mig nu</a></strong> by <strong><a target="_blank" href="spotify:artist:33zLgL7tT1vg7eRpWYX5uI">Miss Li, Lars Winnerbäck</a></strong></td>
<td></td>
</tr>
<tr>
<td>95.</td>
<td><strong><a target="_blank" href="spotify:track:5R9a4t5t5O0IsznsrKPVro">Single Ladies (Put A Ring On It)</a></strong> by <strong><a target="_blank" href="spotify:artist:6vWDO969PvNqNYHIOW5v0m">Beyoncé</a></strong></td>
<td></td>
</tr>
<tr>
<td>96.</td>
<td><strong><a target="_blank" href="spotify:track:0jDWRUbxSn8zQlwFbeLHwo">Evacuate The Dancefloor</a></strong> by <strong><a target="_blank" href="spotify:artist:5BoFxAHL4lunOzKtO3bOL0">Cascada</a></strong></td>
<td></td>
</tr>
<tr>
<td>97.</td>
<td><strong><a target="_blank" href="spotify:track:6J2Gg6h1pnLi6kijjXOXCs">The Funeral</a></strong> by <strong><a target="_blank" href="spotify:artist:0OdUWJ0sBjDrqHygGUXeCF">Band of Horses</a></strong></td>
<td></td>
</tr>
<tr>
<td>98.</td>
<td><strong><a target="_blank" href="spotify:track:4xJjD28UsZlqbX7tBV3Aj5">Bad</a></strong> by <strong><a target="_blank" href="spotify:artist:3fMbdgg4jU18AjLCKBhRSm">Michael Jackson</a></strong></td>
<td></td>
</tr>
<tr>
<td>99.</td>
<td><strong><a target="_blank" href="spotify:track:3tvWMBIblzT5FSjKtIeRR1">Whatever You Like</a></strong> by <strong><a target="_blank" href="spotify:artist:4OBJLual30L7gRl5UkeRcT">T.I.</a></strong></td>
<td></td>
</tr>
<tr>
<td>100.</td>
<td><strong><a target="_blank" href="spotify:track:6PPu2SJkd5XmHU7q4QifbQ">New Divide</a></strong> by <strong><a target="_blank" href="spotify:artist:6XyY86QOPPrYVGvF9ch6wz">Linkin Park</a></strong></td>
</tr>
</tbody>
</table>
<p>List provided thanks to <a href="http://soyplastic.net/top-100-con-lo-mas-escuchado-en-spotify-en-2009">soyplastic</a>.</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/aZ8g5TTtb7Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/spotify-links/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://neo22s.com/spotify-links/</feedburner:origLink></item>
		<item>
		<title>WP-Rir, Plugin to prevent you to do image hotlinking</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/J-sh8dbkuc8/</link>
		<comments>http://neo22s.com/wp-rir/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 18:13:09 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=804</guid>
		<description><![CDATA[First of all, Merry Xmas!!!
Do you remember rir.li this service to prevent you to do image hotlinking?
To make easier the usage of this service, here you have the plugin for WordPress.
Installation:

Download
In your WordPress go to admin Dashboard -&#62; Plugins -&#62; Add new-&#62;Upload
Select the downloaded file
Activate
Enjoy ;)

Usage:
Once it&#8217;s installed, you can use it to copy any [...]]]></description>
			<content:encoded><![CDATA[<p><strong>First of all, Merry Xmas!!!</strong></p>
<p>Do you remember <a href="http://rir.li/">rir.li</a> this service to prevent you to do image hotlinking?</p>
<p>To make easier the usage of this service, here you have the plugin for WordPress.</p>
<p><strong>Installation:</strong></p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/wp-rir/">Download</a></li>
<li>In your WordPress go to admin Dashboard -&gt; Plugins -&gt; Add new-&gt;Upload</li>
<li>Select the downloaded file</li>
<li>Activate</li>
<li>Enjoy ;)</li>
</ul>
<p><strong>Usage:</strong><br />
Once it&#8217;s installed, you can use it to copy any images in the service of rir.li like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;rir&gt;http://www.turisbot.com/images/maastricht.jpg&lt;/rir&gt;</pre></div></div>

<p>or</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">[rir]http://www.turisbot.com/images/maastricht.jpg[/rir]</pre></div></div>

<img src="http://feeds.feedburner.com/~r/Neo22s/~4/J-sh8dbkuc8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/wp-rir/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://neo22s.com/wp-rir/</feedburner:origLink></item>
		<item>
		<title>PHP Class for better cache – fileCache</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/bOadaGZZWfA/</link>
		<comments>http://neo22s.com/filecache/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 10:32:24 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=798</guid>
		<description><![CDATA[Last days I&#8217;m working making many changes in Open Classifieds and one of them is this new class to handle the cache.
Few days a go I wrote about a cache class and longer a go about application variables for php. This is a mix of both in just one powerful class.  
Explanation:

In this class [...]]]></description>
			<content:encoded><![CDATA[<p>Last days <strong>I&#8217;m working making many changes in Open Classifieds</strong> and one of them is this new class to handle the cache.</p>
<p>Few days a go I wrote about a <a href="http://neo22s.com/cache-class-for-php/">cache class</a> and longer a go about <a href="http://neo22s.com/simple-cache-for-php/">application variables for php</a>. This is a mix of both in just <strong>one powerful class.</strong>  </p>
<p><strong>Explanation:<br />
</strong><br />
In this class we have 2 different kinds of cache.</p>
<p><strong>First the normal file cache</strong>, where we store values in a single file. This is good for example to cahe an entire page.</p>
<p><strong>Second</strong> we have an<strong> APPLICATION</strong> kind integrated in the cache. This means that whatever you store in the APP cache it would be kept in the same file as all the other APP. Really useful to store small amount of data, for example menus, counters etc&#8230; Remember that this file is loaded everytime yo create a new object fileCache, you need to be careful to not store many things on it.</p>
<p><strong>Usage:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> fileCache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//$cache= new fileCache(180);//second</span>
<span style="color: #666666; font-style: italic;">//$cache= new fileCache(180,'cache/');//seconds and path</span>
&nbsp;
<span style="color: #666666; font-style: italic;">////cahe application in the same file!!!</span>
<span style="color: #000088;">$test</span><span style="color: #339933;">=</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">APP</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$test</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">APP</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;value test application cache&lt;br /&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$test</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">APP</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test2&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;value test 2 application cache&lt;br /&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//same file as variable test</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//end cache app</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//normal cache in different files</span>
<span style="color: #000088;">$test</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//getting values from cache</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$test</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	<span style="color: #666666; font-style: italic;">//not value from cache found</span>
	<span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;test&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;value test normal cache&lt;br /&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">//save cache			</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$test</span><span style="color: #339933;">;</span>	
<span style="color: #666666; font-style: italic;">//end normal cache</span>
&nbsp;
<span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">deleteCache</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//deletes any cache older than X seconds xD</span></pre></div></div>

<p><strong>The Class:</strong> (<a href="http://lab.neo22s.com/fileCache/fileCache.zip">Download</a>)<br />
<span id="more-798"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * Name:	fileCache
 * URL:		http:/neo22s.com/
 * Version:	v0.1
 * Date:	18/12/2009
 * Author:	Chema Garrido
 * Support: http://forum.neo22s.com
 * License: GPL v3
 * Notes:	fileCache class, used in phpMydb
 */</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/////////////////////class cache</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> fileCache <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_path</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//path for the cache</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_expire</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//seconds that the cache expires</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$application</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//application object like in ASP</span>
 	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$application_file</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//file for the application object</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//cache constructor, optional expiring time and cache path</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> fileCache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$exp_time</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">3600</span><span style="color: #339933;">,</span><span style="color: #000088;">$path</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cache/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_expire</span><span style="color: #339933;">=</span><span style="color: #000088;">$exp_time</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">=</span><span style="color: #000088;">$path</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">APP_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//starting application cache with filename...</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//returns the filename for the cache</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> fileName<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//deletes cache from folder</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> deleteCache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$older_than</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$older_than</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$older_than</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_expire</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$files</span> <span style="color: #339933;">=</span> <span style="color: #990000;">scandir</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$files</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$older_than</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//echo &quot;&lt;br /&gt;-&quot;.$file; </span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//write or read the cache</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> cache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//wants to wirte</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//only write if it's different</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">put</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//reading</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//creates new cache files with the given data, $key== name of the cache, data the info/values to store</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> put<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//able to create the file</span>
	        <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//returns cache for the given key</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//can't read the cache</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_expire</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//cache for the key not expired</span>
			<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// read data file</span>
	        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//able to open the file</span>
	            <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	            <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	            <span style="color: #b1b100;">return</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//return the values</span>
	        <span style="color: #009900;">&#125;</span>
	        <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//was expired you need to create new</span>
 	<span style="color: #009900;">&#125;</span>
&nbsp;
 	<span style="color: #666666; font-style: italic;">//load variables from the file</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> APP_start <span style="color: #009900;">&#40;</span><span style="color: #000088;">$app_file</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;application&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #339933;">=</span><span style="color: #000088;">$app_file</span><span style="color: #339933;">;</span>
&nbsp;
	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// if data file exists, load the cached variables</span>
	        <span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// read data file</span>
	        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	            <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	            <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        <span style="color: #009900;">&#125;</span>
	        <span style="color: #666666; font-style: italic;">// build application variables from data file</span>
	        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application</span> <span style="color: #339933;">=</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	    <span style="color: #b1b100;">else</span>  <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//if the file does not exist we create it</span>
&nbsp;
	    <span style="color: #666666; font-style: italic;">//erase the cache every X minutes before loading next time</span>
		<span style="color: #000088;">$app_time</span><span style="color: #339933;">=</span><span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_expire</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #000088;">$app_time</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">unlink</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//erase the cache</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// write application data to file</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> APP_write<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		    <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application_file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;w&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		        <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		        <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//returns the value or stores it</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> APP<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span><span style="color: #000088;">$value</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//wants to wirte</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">APP_write</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//reading</span>
			<span style="color: #000088;">$return</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">application</span><span style="color: #009900;">&#91;</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$return</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//nothing found</span>
			<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$return</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//return value</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/Neo22s/~4/bOadaGZZWfA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/filecache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/filecache/</feedburner:origLink></item>
		<item>
		<title>Don’t forget in your web site…</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/07McqPjXspo/</link>
		<comments>http://neo22s.com/dont-forget-in-your-web-site/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 11:55:23 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=265</guid>
		<description><![CDATA[Just a list of things that you can&#8217;t forget in your web site:
Legal stuff (for Spain):

LSSI, Ley de Servicios de la Sociedad de la Información, only if you have benefits form your site

LOPD, Ley orgánica de protección de datos, if you store data from you clients, customers, visitors&#8230;

Privacy Policy, about cookies, links to 3rd parts, terms and conditions&#8230;


Search Engine Optimization [...]]]></description>
			<content:encoded><![CDATA[<h3>Just a list of things that you can&#8217;t forget in your web site:</h3>
<p><strong>Legal stuff (for Spain):</strong></p>
<ul>
<li><strong>LSSI</strong>, <a href="http://www.deambulando.com/2009/03/03/como-generar-el-texto-legal-de-la-lssi/" target="_blank">Ley de Servicios de la Sociedad de la Información</a>, only if you have benefits form your site<a href="http://www.deambulando.com/2009/03/03/como-generar-el-texto-legal-de-la-lssi/"><br />
</a></li>
<li><strong>LOPD</strong>, <a rel="nofollow" href="http://es.wikipedia.org/wiki/Ley_Org%C3%A1nica_de_Protecci%C3%B3n_de_Datos_de_Car%C3%A1cter_Personal_de_Espa%C3%B1a" target="_blank">Ley orgánica de protección de datos</a>, if you store data from you clients, customers, visitors&#8230;<a href="http://es.wikipedia.org/wiki/Ley_Org%C3%A1nica_de_Protecci%C3%B3n_de_Datos_de_Car%C3%A1cter_Personal_de_Espa%C3%B1a"><br />
</a></li>
<li><strong>Privacy Policy,</strong> about cookies, links to 3rd parts, terms and conditions&#8230;<strong><br />
</strong></li>
</ul>
<p><strong>Search Engine Optimization (SEO)</strong>:</p>
<ul>
<li><strong>Title, description and keywords <span style="font-weight: normal;">dynamically generated depending on the content.</span></strong></li>
<li><strong>Friendly URLS</strong> (human readable URI)</li>
<li><strong>Title</strong> and alternative text for all the images!</li>
<li><strong>Robots.txt:</strong> say to the bots what they can/can&#8217;t see or how often they can do it.</li>
<li><strong>Sitemap.xml:</strong> Say to the bots what&#8217;s updated and when</li>
</ul>
<p><strong>User/Browser:</strong></p>
<ul>
<li><strong>About:</strong> I think it is important to know a bit more about the site or what they are reading&#8230;</li>
<li><strong>FAQ</strong>: I&#8217;m sure there&#8217;s always questions and you have the right answers, important to keep it updated</li>
<li><strong>Cookies: </strong>Check if the browser of the user able you to read them&#8230;</li>
<li><strong>JavaScript: </strong>Check that JavaScript is enabled or they could not enjoy your beautiful ajax&#8230;</li>
<li><strong>Screen resolution: </strong>Don&#8217;t do a site with fixed width of 1600px&#8230;almost no one have that, my preference is a variable width.</li>
<li><strong>Sitemap</strong>: Make easier to the users to browse your site with a proper sitemap</li>
<li><strong>Contact: </strong>Just a contact form, makes you more reliable in front of the user and really useful. really important.</li>
<li><strong>Search:</strong> Is always welcome an small form to make a search</li>
<li><strong>Favicon:</strong> Something really simple to do but would make lot easier to see your site in a tabbed browsing</li>
<li><strong>NO pop ups</strong>: That&#8217;s terrible! please no Java Script pop up! at least use some modal box or something more friendly&#8230;</li>
<li><strong>RSS:</strong> This is mandatory&#8230;make to your regular readers live easier!</li>
</ul>
<p><strong>Make money  / ask for money:</strong></p>
<ul>
<li><strong>Paypal:</strong> I think nowadays is the best way to receive donations or to pay for something.</li>
<li><strong>Adsense:</strong> Use some adsense just if it&#8217;s not a professional site of course&#8230;you don&#8217;t want the people to leave your site without buying!</li>
</ul>
<p><strong>Statistics:</strong></p>
<ul>
<li><strong>Google analitycs:</strong> Really important to analyze your traffic!</li>
<li><strong>Site Up Time:</strong> also important to know if your site is down or not!</li>
</ul>
<p><strong>Finally:</strong></p>
<ul>
<li>If our site it&#8217;s about <strong>downloads or videos, use external services</strong> such as megaupload daylimotion imageshack&#8230;.</li>
<li>It&#8217;s your site fast enough? is compatible with other browsers? many small details that are important</li>
</ul>
<p>As you can see I don&#8217;t say anything about flash web sites, since you can do nothing of this almost xD</p>
<p>I&#8217;ve forgot something? Any ideas?</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/07McqPjXspo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/dont-forget-in-your-web-site/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://neo22s.com/dont-forget-in-your-web-site/</feedburner:origLink></item>
		<item>
		<title>Open Classifieds 2.0 – Draft</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/e6bDGT0eID4/</link>
		<comments>http://neo22s.com/open-classifieds-2-0-draft/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 15:01:12 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Open Classifieds]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=781</guid>
		<description><![CDATA[Finally today I&#8217;ve got enough time to start a draft about Open Classifieds 2.0.
Idea and Why?
It&#8217;s time for a change, there&#8217;s too many things that OC versions 1.x is not able to do.
For instance you can&#8217;t set location for your advertisements, there&#8217;s not a proper control panel (dashboard), no user registration, not possible to pay [...]]]></description>
			<content:encoded><![CDATA[<p>Finally today I&#8217;ve got enough time to start a draft about <strong>Open Classifieds 2.0.</strong></p>
<h3>Idea and Why?</h3>
<p>It&#8217;s time for a<strong> change</strong>, there&#8217;s too many things that OC versions 1.x is not able to do.</p>
<p>For instance you can&#8217;t set location for your advertisements, there&#8217;s not a proper control panel (dashboard), no user registration, not possible to pay for ad, you can&#8217;t change language&#8230;</p>
<p>Also for an small project as OC, was ok to use <strong>procedure development, but now I&#8217;m finding really difficult to continue</strong> like this and I need to change the technology. <strong>Object Oriented</strong> is the most probably, using some sort of MVC (Model View Controler). As Framework I&#8217;m already working in one to manage DB, localization, cache &#8230;.</p>
<p><strong>Open Classifieds it&#8217;s been downloaded 8.500 times,</strong> there&#8217;s lot of sites using OC, lot of people interested in the project and I feel for doing (with some help if it&#8217;s possible) something great.</p>
<h3>Meet the Requirements</h3>
<p>I did a bit of <a href="http://neo22s.com/regarding-requirements-engineer-certified/">Requirement Engineering</a>, to see what&#8217;s needed. But it&#8217;s difficult since the client can be anyone, not only me.</p>
<p>Please think that <strong>not any of this requirements are for sure. Your feedback in this is really important.</strong></p>
<p>Functional requirements:</p>
<ul>
<li><strong>Location</strong>:  Would be possible to browse advertisements by location and do something like this USA-&gt;California-&gt;San Francisco</li>
<li><strong>User:</strong> To post you must be registered. To make it easier to the end user, OpenID, Google or Facebook to login would be possible. In this way always we could see the posts from a single user.</li>
<li><strong>Localization: </strong>To make localization possible, now would be possible to choose the currency and language by location.  Also categories could be translated. Also each user could set this parameters in their own settings. For the translations probably I would use glotpress.org.</li>
<li><strong>Pay to post:</strong> Many people asked to be able to set a rate to pay if they want to post, this would be controlled by the category. This would use Paypal.</li>
<li><strong>Dashboard: </strong>right now all the options are stored as defines. The idea is to have it in a Table, to make lot easier to the admin to manage any configuration parameter.</li>
</ul>
<p>No functional requirements:</p>
<ul>
<li>Object Oriented</li>
<li>New DB model</li>
<li>New framework</li>
</ul>
<p>Possible deprecated:</p>
<ul>
<li><strong>Post Type:</strong> there&#8217;s a need to set the type? like Need, Offer, Sell, Buy? it&#8217;s important? many Classifieds sites don&#8217;t use this</li>
<li><strong>Post Pictures:</strong> The path for the pictures, would be no longer stored in the DB, I don&#8217;t see it necessarily, since you can always read the content of the folder for each post and from there read the images.</li>
</ul>
<p>With <a href="http://www.bubbl.us/">bubbl.us</a> I did this brainstorming:</p>
<p><a href="http://neo22s.com/wp-content/uploads/2009/12/bubblus_OC.2.0.jpg"><img class="alignnone size-medium wp-image-784" title="Open Classifieds 2.0 requirements draft" src="http://neo22s.com/wp-content/uploads/2009/12/bubblus_OC.2.0-300x176.jpg" alt="Open Classifieds 2.0 requirements draft" width="300" height="176" /></a></p>
<p>Any other ideas?</p>
<h3>DB Model</h3>
<p>This is an example for the requirements translated to DB:</p>
<p><a href="http://neo22s.com/wp-content/uploads/2009/12/sql_OC2.png"><img class="alignnone size-medium wp-image-785" title="sql database model for open classifieds 2.0 draft" src="http://neo22s.com/wp-content/uploads/2009/12/sql_OC2-300x188.png" alt="sql database model for open classifieds 2.0 draft" width="300" height="188" /></a></p>
<h3>Help is needed</h3>
<p><strong><span style="font-weight: normal;">List of things that I&#8217;m short of:</span></strong></p>
<ul>
<li><strong>Design: </strong>I need a logo, design for Open Classifieds,  Open Classifieds site, dashboard, installation, forums&#8230;..I know it&#8217;s a lot of work but later you would get your part of glory, been part of the team. I&#8217;m sorry I&#8217;m that bad designer&#8230;.</li>
<li><strong>SEO: </strong>Some SEO help would be much appreciate it since this would really help the project to succeed.</li>
<li><strong>Sponsors:</strong> We need sponsors to support this project, money it&#8217;s a need for hosting and at least cover minimal expenses such as rentals, drinks, transport&#8230; for meetings. Also Investment would be really great to move forward and welcome.</li>
<li><strong>Translators: </strong>As you can see my English it&#8217;s not the best ever&#8230;I&#8217;m still learning how to write properly&#8230;but anyway any other language would be great! sure!</li>
<li><strong>Marketing</strong>: What about someone to deal with affiliates, adsense and get new ways of making money or to advertise our software? if it&#8217;s you don&#8217;t wait!</li>
</ul>
<h3>Join the team</h3>
<p>The perfect scenario would be to <strong>make an small team </strong>(3 people), to split work and do a <strong>meeting</strong> sometimes in <strong>Barcelona</strong>. I have a friend&#8217;s place (restaurant) that they will let us be there for free and they will provide us with some beverage.</p>
<p>Also this will may be good for you to know other people with your own interests, have some fun, drink some beers and who knows even make some money in the future (there&#8217;s already some income).</p>
<p><strong>As part of the team you would be involved at any decision</strong>. There&#8217;s some market ideas I need to develop but they can be really good.</p>
<p>Please if you are interested s<strong>end an email to chema (at) garridodiaz.com</strong>, of course never mind to talk Spanish ;)</p>
<h3>Notes</h3>
<p><strong>This is just a draft</strong>. I have <strong>no idea when this would be possible</strong>, it depends of how much free time I  have, how much help I get on developing and not any stopper (as another project).</p>
<p>But I really would like to have it done by/or during summer.</p>
<p><strong>Any comment or feedback or help, everything it&#8217;s really welcome.</strong></p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/e6bDGT0eID4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/open-classifieds-2-0-draft/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		<feedburner:origLink>http://neo22s.com/open-classifieds-2-0-draft/</feedburner:origLink></item>
		<item>
		<title>Add PDF files inside other PDF in PHP</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/fcTtTINDG9U/</link>
		<comments>http://neo22s.com/add-pdf-files-inside-other-pdf-in-php/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 19:53:03 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=256</guid>
		<description><![CDATA[Scenario:
We have some data sotred in a data base that must be returned as PDF.
Sounds easy but what if I tell you that between that data you need to attach other PDF files?
It makes everything more complicated. We already saw how to convert from Word to PDF in PHP and Concatenate PDF in PHP but that&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Scenario:</strong></p>
<p>We have some<strong> data sotred in a data base that must be returned as PDF.</strong></p>
<p>Sounds easy but what if I tell you that<strong> between that data you need to attach other PDF files?</strong></p>
<p>It makes everything more complicated. We already saw how to convert from <a title="Permanent Link to Word to PDF in PHP" rel="bookmark" href="http://neo22s.com/word-to-pdf-in-php/">Word to PDF in PHP</a> and <a title="Permanent Link to Concatenate PDF in PHP" rel="bookmark" href="http://neo22s.com/concatenate-pdf-in-php/">Concatenate PDF in PHP</a> but that&#8217;s not enough&#8230;</p>
<p>First download in your work space <a href="http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf" target="_blank">TCPDF</a> and <a href="http://www.setasign.de/products/pdf-php-solutions/fpdi/downloads/" target="_blank">FPDI</a>.</p>
<p>Then you can use this class I did for this.<br />
<span id="more-256"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//CONFIG</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tcpdf/tcpdf.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fpdi/fpdi.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//concatenation</span>
<span style="color: #666666; font-style: italic;">//END CONFIG</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> PDFmaker <span style="color: #000000; font-weight: bold;">extends</span> FPDI<span style="color: #009900;">&#123;</span>
	  <span style="color: #666666; font-style: italic;">/////////////////////////////////////////////////</span>
  <span style="color: #666666; font-style: italic;">// PROPERTIES, PUBLIC</span>
  <span style="color: #666666; font-style: italic;">/////////////////////////////////////////////////</span>
	<span style="color: #666666; font-style: italic;">//here we set the default font, margins, etc.</span>
	<span style="color: #666666; font-style: italic;">//TODO define the default parameters for font, etc.</span>
&nbsp;
	protected <span style="color: #000088;">$idDocument</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000088;">$header</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> PDFmaker<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span>__construct<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'P'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'mm'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'A4'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> configPdfFile<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//set margins</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetMargins</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	 <span style="color: #666666; font-style: italic;">//Page header</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">Header</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// set header fonts</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setHeaderFont</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'arial'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> PDF_FONT_SIZE_MAIN<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    	<span style="color: #666666; font-style: italic;">//Set the margins</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetY</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    	<span style="color: #666666; font-style: italic;">// Colors, line width and bold font</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFillColor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetTextColor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetDrawColor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetLineWidth</span><span style="color: #009900;">&#40;</span><span style="color:#800080;">0.1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFont</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetX</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//Carriage return to the following line</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ln</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Color and font restoration</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFillColor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetTextColor</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFont</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #666666; font-style: italic;">// Line break</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ln</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Page footer</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	<span style="color: #666666; font-style: italic;">//Set footer margin</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFooterMargin</span><span style="color: #009900;">&#40;</span>PDF_MARGIN_FOOTER<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #666666; font-style: italic;">// set header and footer fonts</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setHeaderFont</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span>PDF_FONT_NAME_MAIN<span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> PDF_FONT_SIZE_MAIN<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setFooterFont</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span>PDF_FONT_NAME_DATA<span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> PDF_FONT_SIZE_DATA<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Position at 1.5 cm from bottom</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetY</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Set font</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFont</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'helvetica'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'I'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Page number</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Cell</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Page '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAliasNumPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAliasNbPages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'C'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> addPdfText<span style="color: #009900;">&#40;</span><span style="color: #000088;">$htmlMyText</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
    	<span style="color: #666666; font-style: italic;">//check if there is already a page in the document. If there is no page it must be created before</span>
    	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddPage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'P'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #009900;">&#125;</span>
    	<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//if there is already a page, the cursor must point to it</span>
    		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPage</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #009900;">&#125;</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">writeHTML</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$htmlMyText</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'J'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #666666; font-style: italic;">//Without the following line, next time we use addPdfText the first line of the new content will overlap the last line that was already written in the document</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ln</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #666666; font-style: italic;">//Now we leave the cursor in the last page, ready for a future addition of more content</span>
    	<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
    <span style="color: #009900;">&#125;</span>
&nbsp;
 	protected <span style="color: #000000; font-weight: bold;">function</span> AddPagePdf<span style="color: #009900;">&#40;</span><span style="color: #000088;">$orientation</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">original_lMargin</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">original_lMargin</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lMargin</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">original_rMargin</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">original_rMargin</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rMargin</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #666666; font-style: italic;">// terminate previous page</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">endPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// start new page</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">startPagePdf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$orientation</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	protected <span style="color: #000000; font-weight: bold;">function</span> startPagePdf<span style="color: #009900;">&#40;</span><span style="color: #000088;">$orientation</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">numpages</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">page</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #666666; font-style: italic;">// this page has been already added</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPage</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">page</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetY</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tMargin</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #666666; font-style: italic;">// start a new page</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">state</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #339933;">++</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">numpages</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">swapMargins</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">booklet</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// save current graphic settings</span>
			<span style="color: #000088;">$gvars</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getGraphicVars</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// start new page</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_beginpage<span style="color: #009900;">&#40;</span><span style="color: #000088;">$orientation</span><span style="color: #339933;">,</span> <span style="color: #000088;">$format</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// mark page as open</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pageopen</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">page</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// restore graphic settings</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setGraphicVars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$gvars</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// mark this point</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPageMark</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// print page header</span>
			<span style="color: #666666; font-style: italic;">//$this-&gt;setHeader();</span>
			<span style="color: #666666; font-style: italic;">// restore graphic settings</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setGraphicVars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$gvars</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// mark this point</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPageMark</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// print table header (if any)</span>
			<span style="color: #666666; font-style: italic;">//$this-&gt;setTableHeader();</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> addPdfFile<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	    <span style="color: #666666; font-style: italic;">//check if there is already a page in the document. If there is no page it must be created before</span>
	    	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddPage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'P'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    	<span style="color: #b1b100;">else</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPage</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//if there is already a page, the cursor must point to it</span>
&nbsp;
     		<span style="color: #000088;">$pagecount</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setSourceFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$pagecount</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 <span style="color: #000088;">$tplidx</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ImportPage</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTemplatesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tplidx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddPagePdf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'P'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'h'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ln</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'h'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">useTemplate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tplidx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And as an example of usage:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pdfMaker.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//Create the pdf object and configure it</span>
	<span style="color: #000088;">$pdf</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span>  PDFmaker<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">configPdfFile</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetCreator</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;some name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetAuthor</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;some name&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;some title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetSubject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;some subject&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//set auto page breaks</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetAutoPageBreak</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span> PDF_MARGIN_BOTTOM<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//set image scale factor</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setImageScale</span><span style="color: #009900;">&#40;</span>PDF_IMAGE_SCALE_RATIO<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Bookmark</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$anyName</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addPdfText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;h1&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$anyName</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/h1&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addPdfFile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pdf_path</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//ADD TOC</span>
		<span style="color: #666666; font-style: italic;">// add a new page for TOC</span>
		<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">AddPage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// write the TOC title</span>
		<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">MultiCell</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Content table'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'C'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Ln</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// add table of content at page 1</span>
		<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addTOC</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//End TOC</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//Close and output PDF document</span>
	<span style="color: #000088;">$pdf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Output</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;pdf_file_name&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'I'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/Neo22s/~4/fcTtTINDG9U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/add-pdf-files-inside-other-pdf-in-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://neo22s.com/add-pdf-files-inside-other-pdf-in-php/</feedburner:origLink></item>
		<item>
		<title>Cache Class for PHP</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/XZTtZO_Xe_U/</link>
		<comments>http://neo22s.com/cache-class-for-php/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 12:45:05 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=775</guid>
		<description><![CDATA[Just another php cache class that you can find in Internet..
The difference? super easy to use ;)
Usage:
Initialize:

$cache = new Cache&#40;&#41;;

Set expire time (by default 3600 seconds)

$cache = new Cache&#40;15&#41;;

Set the path (by default &#8220;cache/&#8221;)

$cache = new Cache&#40;120,&#34;/any_other_path/&#34;&#41;;

Read a &#8220;Key&#8221;:

$value = $cache-&#62;get&#40;&#34;some_data&#34;&#41;;

Write a &#8220;Key&#8221;:

$cache-&#62;put&#40;&#34;some_data&#34;, &#34;some_value&#34;&#41;;

Full example to cache a query:

$cache = new Cache&#40;&#41;;
$values = $cache-&#62;get&#40;$query&#41;;//setting values [...]]]></description>
			<content:encoded><![CDATA[<p>Just another php cache class that you can find in Internet..</p>
<p>The difference? super easy to use ;)</p>
<p><strong>Usage:</strong><br />
Initialize:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Cache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Set expire time (by default 3600 seconds)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Cache<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Set the path (by default &#8220;cache/&#8221;)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Cache<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">120</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;/any_other_path/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Read a &#8220;Key&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;some_data&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Write a &#8220;Key&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;some_data&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;some_value&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Full example to cache a query:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cache</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Cache<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//setting values from cache</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$values</span><span style="color: #339933;">==</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	<span style="color: #666666; font-style: italic;">//not value from cache found</span>
	<span style="color: #000088;">$result</span><span style="color: #339933;">=</span><span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">mysql_num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//checking if there's more than one result</span>
		<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>  <span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$values</span><span style="color: #339933;">,</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">//feed array</span>
		<span style="color: #000088;">$cache</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">put</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #666666; font-style: italic;">//save cache			</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>		
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>The Class:</strong><br />
<span id="more-775"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Cache <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_path</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//path for the cache</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$cache_expire</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//seconds that the cache expires</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//cache constructor, optional expiring time and cache path</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Cache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$exp_time</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">3600</span><span style="color: #339933;">,</span><span style="color: #000088;">$path</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cache/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_expire</span><span style="color: #339933;">=</span><span style="color: #000088;">$exp_time</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">=</span><span style="color: #000088;">$path</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//returns the filename for the cache</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">function</span> fileName<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_path</span><span style="color: #339933;">.</span><span style="color: #990000;">md5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//creates new cache files with the given data, $key== name of the cache, data the info/values to store</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> put<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">serialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//able to create the file</span>
	        <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$values</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	        <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	    <span style="color: #009900;">&#125;</span>
	    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">//returns cache for the given key</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fileName</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_readable</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//can't read the cache</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">filemtime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cache_expire</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//cache for the key not expired</span>
			<span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// read data file</span>
	        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #666666; font-style: italic;">//able to open the file</span>
	            <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	            <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	            <span style="color: #b1b100;">return</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//return the values</span>
	        <span style="color: #009900;">&#125;</span>
	        <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//was expired you need to create new</span>
 	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<img src="http://feeds.feedburner.com/~r/Neo22s/~4/XZTtZO_Xe_U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/cache-class-for-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://neo22s.com/cache-class-for-php/</feedburner:origLink></item>
		<item>
		<title>Twitter Badge for WordPress</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/FgR34fRw5eI/</link>
		<comments>http://neo22s.com/wptwitterbadge/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 11:19:34 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=766</guid>
		<description><![CDATA[New plugin ;)
Today I&#8217;ve made a new plugin to use the Twitter Badge generator easily in your WP.
Features:

 No image or flash for text
 No JavaScript needed
Link directly to you twitter account!
You can select background color, text color and your own text

== Installation ==
To install it you can do as any other plugin of WP.
* [...]]]></description>
			<content:encoded><![CDATA[<p>New plugin ;)</p>
<p>Today I&#8217;ve made a new plugin to use the <a href="http://lab.neo22s.com/twitterBadge/">Twitter Badge generator</a> easily in your WP.</p>
<p><strong>Features:</strong></p>
<ul>
<li> No image or flash for text</li>
<li> No JavaScript needed</li>
<li>Link directly to you twitter account!</li>
<li>You can select background color, text color and your own text</li>
</ul>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">== Installation ==</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">To install it you can do as any other plugin of WP.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">* Upload (you can do it to from the control panel) it to your /wp-content/plugins/ folder and activate it!</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">* Then you need to configure it</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">* Check your homepage it will be in the right side</div>
<p><strong> Installation</strong></p>
<p>To install it you can do as any other plugin of WP.</p>
<ul>
<li>Upload (you can do it to from the control panel) it to your /wp-content/plugins/ folder and activate it!</li>
<li>Then you need to configure it</li>
<li>Check your homepage it will be in the right side</li>
</ul>
<p><strong>NOTE: </strong>Works in Works in FF 3.5, Chromium (<span style="font-family: arial, sans-serif; line-height: normal; border-collapse: collapse;">No Autoscroll<span style="border-collapse: separate; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px;">), ie7,ie8, NO IE6.</span></span></p>
<p><a href="http://wordpress.org/extend/plugins/twitter-badge/">Download from wordpress.org</a></p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/FgR34fRw5eI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/wptwitterbadge/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://neo22s.com/wptwitterbadge/</feedburner:origLink></item>
		<item>
		<title>WP-Datediff – Plugin for WordPress</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/juX2uZsJlx8/</link>
		<comments>http://neo22s.com/wp-datediff/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 08:27:44 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=272</guid>
		<description><![CDATA[Super simple plugin that allow us to know the difference between dates in WP.
What is useful for?
In my case in few blogs I only display advertisements when the post is older than 7 days for example. For this I need to know the difference between dates, in a easy way.
Download
Usage:
To display  something (like an ad) depending on [...]]]></description>
			<content:encoded><![CDATA[<p>Super simple plugin that allow us to know the difference between dates in WP.</p>
<p><strong>What is useful for?</strong></p>
<p>In my case in few blogs I only display advertisements when the post is older than 7 days for example. For this I need to know the difference between dates, in a easy way.</p>
<p><a href="http://lab.neo22s.com/WP-Datediff/WP-Datediff.zip"><strong>Download</strong></a></p>
<p><strong>Usage:</strong></p>
<p>To display  something (like an ad) depending on a a expiring date:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>post_is_expired<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;display something&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>As a param we have number of days, by default is 30. Returns true or false if it&#8217;s expired or not.</p>
<p>Date difference for a post:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$p_time</span><span style="color: #339933;">=</span>datediff_post<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;2008-01-12&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;M&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>First parameter, date  in  YYYY-MM-DD format, second parameter can be “D” day , “M” month or “Y” year.</p>
<p>Returns in the specified second parameter an int with the difference.</p>
<p><strong>Install:</strong></p>
<ul>
<li><a href="http://lab.neo22s.com/WP-Datediff/WP-Datediff.zip"><span style="font-weight: bold;">Download</span></a></li>
<li>Go to your WP Dashboard</li>
<li>Plugins -&gt; Add New -&gt; Upload -&gt; Select the WP-Datediff.zip file</li>
<li>Activate plugin</li>
<li>Now, you may want to edit your single.php file form your theme for example to enable the datediff</li>
</ul>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/juX2uZsJlx8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/wp-datediff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/wp-datediff/</feedburner:origLink></item>
		<item>
		<title>Requirements Engineer certified</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/WQ_lQBxOqgI/</link>
		<comments>http://neo22s.com/regarding-requirements-engineer-certified/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 22:06:07 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=750</guid>
		<description><![CDATA[I have read this article from Barbara Paech, where explain to us the where abouts of the Certified Professional for Requirements Engineering and I would like to share my thoughts about it.
First of all, maybe it is helpful to know what I&#8217;m talking about with this introduction on wikipedia Requirements Engineering , that since now on  I will abbreviate as [...]]]></description>
			<content:encoded><![CDATA[<p>I have read this <a href="http://www.computer.org/portal/web/csdl/doi/10.1109/MS.2008.106">article from Barbara Paech</a>, where explain to us the where abouts of the <a href="http://certified-re.de/en/certification/certification-model/">Certified Professional for Requirements Engineering</a> and I would like to share my thoughts about it.</p>
<p>First of all, maybe it is helpful to know what I&#8217;m talking about with this introduction on wikipedia <a href="http://en.wikipedia.org/wiki/Requirements_analysis">Requirements Engineering</a> , that since now on  I will abbreviate as RE.</p>
<p>I&#8217;m <strong>not a big fan for certified</strong>, but I must admit that now a days they seem to be pretty <strong>useful when you seek for work</strong>.</p>
<p>When you are certified and for my experience (Master in Java architecture), you have already an <strong>advantage over the rest of the candidates</strong>, Why? normally <strong>Human Resources are not qualified IT</strong> people, been certified makes for them easier this &#8220;first&#8221; selection  over other selective points.</p>
<p>We should not forget that <strong>once you are certified means that you past a test that you studied for it</strong>, you will share common language and is supposed you have same knowledge as any other.</p>
<p><strong>I never liked exams at all.</strong> I&#8217;ve been a good student always and I had great scores, but come on,<strong> because you have good scores doesn&#8217;t mean that much,</strong> I explain: <strong>I rather do an small &#8220;work&#8221; where I can use what I&#8217;m learning and that may be useful in the future than doing an exam </strong>where you study, normally without understanding, you do the exam and you may forget. If you did a &#8220;work/project&#8221; you will always have it and the research you may do, brings to you much more.</p>
<p>Other point why <strong>been certified is not fair at all </strong>comes when you have an <strong>innate talent</strong>, there&#8217;s this people that seems to be so good at RE, but they have the same certified as one that really have no idea. Your innate talent may be<strong> communication skills,</strong> good speaker for example, or good at understanding problems and listening. This things <strong>hardly you will learn them</strong>.</p>
<p>Same happens<strong> if you have been working for 10 years or a newbie, you have the same certified</strong>.</p>
<p>Finishing my point is:<strong> It&#8217;s up to you to be certified or not</strong>, but I&#8217;ve been involved in few work position selections and there&#8217;s things that are more important, experience, talent, work dedication&#8230; that are far <strong>more important than been certified</strong>.</p>
<p>As a resume from my perspective:</p>
<p><strong>Pros:</strong></p>
<ul>
<li>Certifies your knowledge about RE.</li>
<li>Usage of common syllabus.</li>
<li>It may be useful for seeking work.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>Knowledge can be forget.</li>
<li>Doesn&#8217;t demonstrate work experience.</li>
<li>Not value for innate talent.</li>
<li>Not certified for your communicative skills.</li>
</ul>
<p><a href="http://en.wikipedia.org/wiki/Requirements_analysi"><br />
</a></p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/WQ_lQBxOqgI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/regarding-requirements-engineer-certified/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://neo22s.com/regarding-requirements-engineer-certified/</feedburner:origLink></item>
		<item>
		<title>New Open Classifieds theme – Aqueous</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/rrjRRXdYYY0/</link>
		<comments>http://neo22s.com/new-open-classifieds-theme-aqueous/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 18:32:23 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Open Classifieds]]></category>

		<guid isPermaLink="false">http://neo22s.com/?p=745</guid>
		<description><![CDATA[Not I only did the last release today, also I&#8217;ve made a new theme. I think looks really good, the originally HTML theme is made by Six Shooter Media.
Now you have in total 9 different themes to install with your OC.
Download Aqueous (Demo in classifieds Barcelona)

Other themes:


Indigo (Demo)
Plain and simple (Demo)
Primitive (Demo)
Simply Fluid (Demo)
Edit_80 (Demo)
neoMobile [...]]]></description>
			<content:encoded><![CDATA[<p>Not I only did the last release today, also I&#8217;ve made a new theme. I think looks really good, the originally HTML theme is made by <a href="http://www.sixshootermedia.com/">Six Shooter Media</a>.</p>
<p>Now you have in total <strong>9 different themes to install with your OC.</strong></p>
<p><strong><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.5_aqueous.tar.gz/download">Download Aqueous</a> (Demo in <a href="http://classifiedsbarcelona.com">classifieds Barcelona)</a></strong></p>
<p><img class="alignnone size-full wp-image-746" title="aqueous-screenshot" src="http://neo22s.com/wp-content/uploads/2009/12/aqueous-screenshot.png" alt="aqueous-screenshot" width="600" height="612" /></p>
<p><strong>Other themes:<br />
</strong></p>
<ul>
<li><a title="Theme Indigo for Open Classifieds 1.1.x" href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.4_Indigo.tar.gz/download">Indigo</a> (<a title="Demo Open Classifieds Indigo" href="http://demo.open-classifieds.com/?theme=Indigo">Demo</a>)</li>
<li><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.4_plainandsimple.tar.gz/download">Plain and simple</a> (<a title="Demo Open Classifieds Plain and simple" href="http://demo.open-classifieds.com/?theme=plainandsimple">Demo</a>)</li>
<li><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.4_primitive.tar.gz/download">Primitive</a> (<a title="Demo Open Classifieds Primitive" href="http://demo.open-classifieds.com/?theme=primitive">Demo</a>)</li>
<li><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.4_simplyfluid.tar.gz/download">Simply Fluid</a> (<a title="Demo Open Classifieds Simply Fluid" href="http://demo.open-classifieds.com/?theme=simplyfluid">Demo</a>)</li>
<li><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.4_edit_80.tar.gz/download">Edit_80</a> (<a title="Demo Open Classifieds Edit_80" href="http://demo.open-classifieds.com/?theme=edit_80">Demo</a>)</li>
<li><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.4_neoMobile.tar.gz/download">neoMobile</a> (<a title="Demo Open Classifieds neoMobile" href="http://demo.open-classifieds.com/?theme=neoMobile">Demo</a> only for mobile devices)</li>
<li><a href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.4/Themes/Theme_OpenClassifieds_1.5_anunciamex.tar.gz/download">anunciamex</a> (<a title="Demo Open Classifieds anunciamex" href="http://demo.open-classifieds.com/?theme=anunciamex">Demo</a>)</li>
</ul>
<p><strong>Question: </strong>Which of them is your favourite?</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/rrjRRXdYYY0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/new-open-classifieds-theme-aqueous/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://neo22s.com/new-open-classifieds-theme-aqueous/</feedburner:origLink></item>
		<item>
		<title>Open Classifieds 1.5.4 released</title>
		<link>http://feedproxy.google.com/~r/Neo22s/~3/hWT4DtPrG5s/</link>
		<comments>http://neo22s.com/open-classifieds-1-5-4-released/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 18:22:48 +0000</pubDate>
		<dc:creator>Chema</dc:creator>
				<category><![CDATA[Open Classifieds]]></category>

		<guid isPermaLink="false">http://neo22s.com/open-classifieds-1-5-4-released/</guid>
		<description><![CDATA[New release today&#8230;and is bank holiday in Spain&#8230;anyway working! hehe
There&#8217;s not big changes, just improvements and especially SEO.
Download Open Classifieds 1.5.4

filter need offer keeps filtered with a session
changes in ocdb.php
if an item is tagged as spam you can not edit anymore
price box made bigger
When you insert code now redirects you to /error/ where we can [...]]]></description>
			<content:encoded><![CDATA[<p>New release today&#8230;and is bank holiday in Spain&#8230;anyway working! hehe</p>
<p>There&#8217;s not big changes, just improvements and especially SEO.</p>
<p><strong><a title="Download Open Classifieds 1.5.4" href="https://sourceforge.net/projects/openclassifieds/files/openclassifieds/1.5/OpenClassifieds_1.5.4.tar.gz/download" target="_blank">Download Open Classifieds 1.5.4</a></strong></p>
<ul>
<li>filter need offer keeps filtered with a session</li>
<li>changes in ocdb.php</li>
<li>if an item is tagged as spam you can not edit anymore</li>
<li>price box made bigger</li>
<li>When you insert code now redirects you to /error/ where we can set other messages</li>
<li>Improved seo title in categories new, index, item&#8230;</li>
<li>contact opened always (you can close it)</li>
</ul>
<p><strong>To upgrade from previous versions:</strong></p>
<ul>
<li>Make a backup of your files and DB, just in case</li>
<li>Erase the files form your FTP (<strong>NOT the folder /images/</strong>)</li>
<li>Upload the new files</li>
<li>Run /install/</li>
<li>Done</li>
</ul>
<p>As always support can be found in the <a href="http://forum.neo22s.com/forum/open-classifieds">official forum</a>.</p>
<img src="http://feeds.feedburner.com/~r/Neo22s/~4/hWT4DtPrG5s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://neo22s.com/open-classifieds-1-5-4-released/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://neo22s.com/open-classifieds-1-5-4-released/</feedburner:origLink></item>
	</channel>
</rss>
