<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
  <channel>
    <title>WESSITE - Stoked on Coding</title>
    <link>http://wessite.com/</link>
    <description>wessite is focused on web development, coding, interaction design</description>
    <language>en-us</language>           
    <generator>Nucleus CMS v3.51</generator>
    <copyright>ï¿½</copyright>             
    <category>Weblog</category>
    <docs>http://backend.userland.com/rss</docs>
    <image>
      <url>http://wessite.com//nucleus/nucleus2.gif</url>
      <title>WESSITE - Stoked on Coding</title>
      <link>http://wessite.com/</link>
    </image>
    <item>
 <title>Spectrum Visualizer Plugin - JW Player</title>
 <link>http://wessite.com/item/2009/10/spectrum-visualizer-plugin---jw-player</link>
<description><![CDATA[A few months ago I started out with Actionscript 3, the programming language to develop on the Adobe Flash Player platform. At the time I wanted to get a “bar spectrum visualization” to show in the browser, like on a real stereo system. I found out Adobe had introduced a new class called SoundMixer in the Flash Player 9 release. This was just what I needed as it gives you the possibility to retrieve the frequencies of music playing in the Flash Player.<br />
<br />
I already had a great music player, the JW player from Longtail Video, so the obvious move was to create a plugin and get the sound visualization on the screen of the JW player. Looking on the internet for similar projects I stumbled upon the blog of <a href="http://www.everydayflash.com/">Bartek Drozdz</a>, he had made a equalizer class in AS3 and posted the source code on his website free to use. This is the result I ended up with. Everybody can get it free of charge at <a href="http://www.longtailvideo.com/addons/plugins/79/Spectrum-Visualizer">Longtail Video's addons section</a>.<br />
<br />
<div id="mediaspace">This div will be replaced</div><br />
<script type='text/javascript'>var s = new SWFObject('http://wessite.com/skins1.0.7/newstyle/player.swf','ply','520','200','10','#ffffff'); s.addParam('allowfullscreen','true'); s.addParam('allowscriptaccess','always'); s.addParam('wmode','opaque'); s.addParam('flashvars','file=/media/ready-or-not.m4a&plugins=http://wessite.com/skins1.0.7/newstyle/spectrumvisualizer-1.swf&spectrumvisualizer.effect=reflection&spectrumvisualizer.xpos=5&backcolor=000000&frontcolor=ffffff'); s.write('mediaspace');</script>A demo page with different configurations can be found in the Labs: <a href="http://wessite.com/labs/spectrumvisualizer">Compute Spectrum Visualizer</a>]]></description>
 <category>Actionscript</category>
<comments>http://wessite.com/item/2009/10/spectrum-visualizer-plugin---jw-player</comments>
 <pubDate>Sun, 11 Oct 2009 21:21:59 +0200</pubDate>
</item><item>
 <title>Add Far Future Expires Headers</title>
 <link>http://wessite.com/item/2008/11/add-far-future-expires-headers</link>
<description><![CDATA[This is the third part of the article <a href="http://wessite.com/item/2008/11/speeding-up-your-nucleus-cms-web-site">Speeding Up your Web Site</a>. The method is really easy to configure and will drastically increase the speed of your web page. I found this optimizing tip at <a href="http://www.askapache.com/htaccess/apache-speed-expires.html">askapache.com</a>:<br />
<br />
<div class="quote">A first-time visitor to your page will make several HTTP requests to download all your sites files, but using the Expires header you make those files cacheable. This avoids unnecessary HTTP requests on subsequent page views.</div><br />
Just put the following lines in your <code>.htaccess</code> file:<br />
<br />
<div class="apache">&lt;FilesMatch <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$&quot;</span>&gt;<br />
<span style="color: #00007f;">Header</span> set Expires <span style="color: #7f007f;">&quot;Thu, 15 Apr 2010 20:00:00 GMT&quot;</span><br />
&lt;/FilesMatch&gt;</div><br />
Store the <code>.htaccess</code> file in the directory from where you want to start adding the far future header, so if you store this in the root all the files on your server with the extensions above will get a far future expires header.<div class="note"><b>Note:</b> if you use a <b>far future Expires header</b> you have to change the component’s file name whenever the file changes.</div><br />
<div class="leftbox"><a href="http://wessite.com/media/1/20081123-wessite_speed3.jpg" onclick="Foto(this.href, 'Speed Graph with Far Expires Header', '800', '469'); return false;"><img src="http://wessite.com/media/1/thumb_20081123-wessite_speed3.jpg" width="229" height="134" alt="Speed Graph with Far Expires Header" /></a></div>By adding these headers I've reduced the load time of this website for the second page view from 3.55 sec to 1.74 seconds. Actually the page rendered completely in 1.16 seconds, but the loading of the video playlists which is asynchronous added some to the total time. At the left you can see a speed graph created by Safari.<br />
<br />
For Nucleus users I also have an additional tip to make maintaining your website even easier. Check it out below.<br />
<br />
As noted above you should always change the component’s file name whenever you change a file with a far future expires header. This can be a real drag if you change your files a lot. A workaround is instead of changing the filename, just change the name of your skin folder at the "configuration" page in the admin area.<br />
<br />
For example to: http://your-nucleus-website.com/skins1.0.1/<br />
<br />
Then with a bit of mod_rewrite magic we can point to the original skin folder at:<br />
<br />
For example: http://your-nucleus-website.com/skins/<br />
<br />
...add this line to the <code>.htaccess</code> file in your root replacing the "default" with your current skin name<br />
<br />
<div class="apache"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span><br />
<span style="color: #00007f;">RewriteBase</span> /<br />
<span style="color: #00007f;">RewriteRule</span> ^skins.*/default/<span style="color: #66cc66;">&#40;</span>.*<span style="color: #66cc66;">&#41;</span>$ skins/default/$<span style="color: #ff0000;">1</span></div><br />
<div class="note"><b>Note:</b> if your preexisting .htaccess file already uses URL rewriting you do not need to add the first two lines. You can simply add the last line to the bottom of the .htaccess file</div><br />
Now you just have to change 1 setting at the configuration page instead of changing al the filenames of the files you edited.<br />
]]></description>
 <category>Optimization</category>
<comments>http://wessite.com/item/2008/11/add-far-future-expires-headers</comments>
 <pubDate>Sun, 23 Nov 2008 12:32:58 +0100</pubDate>
</item><item>
 <title>Combining and Compressing Javascript and CSS Files</title>
 <link>http://wessite.com/item/2008/11/combining-and-compressing-javascript-and-css-files</link>
<description><![CDATA[<b>Reducing the number of HTTP requests is the key to faster pages.</b> As read in the best practices for speeding up your web site:<br />
<br />
<div class="quote">80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages. Combined files are a way to reduce the number of HTTP requests by combining all scripts into a single script, and similarly combining all CSS into a single stylesheet.</div><br />
<a href="http://alistapart.com/articles/sprites">CSS Sprites</a> is another way to reduce the number of requests but we wont be handling sprites in this article.<br />
<br />
So combining of the javascript and CSS files, you can do this either by manually putting all the javascript files in one large file or let a script handle the combining for you. I think I'm gonna choose the latter. The combining script I use on this site is created by a dutch programmer called Rakaz and can be found at this link: <a href="http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files">Make your pages load faster by combining and compressing javascript and css files</a><br />
<br />
This PHP script is awesome, it not only combines your files but also compresses it and stores a cache for instant response time. So just follow the guidelines at the page above and you'll be speeding up your web site in no time. For this site it made a noticeable difference and cut down the load time from 4.69 sec to 3.55 sec.<br />
<br />
For Nucleus CMS users I have tweaked the script a little for ultimate usability, read on below.Download the customized script for Nucleus users at this link: <a href="http://wessite.com/?file=1/combine.php.zip">Combining JS and CSS Script</a><br />
<br />
<b>How to use this script?</b><br />
<br />
<u>Step 1</u> Download the script above, open it and at the top change the variable <span class="php"><span style="color: #0000ff;">$cachedir</span></span> to the directory where you are gonna cache your combined files, if you don't have such a directory create one and make sure it is writable. Secondly change the <span class="php"><span style="color: #0000ff;">$dir</span></span> variable to the directory of your skin. You should get something like:<br />
<br />
<div class="php"><span style="color: #0000ff;">$cache</span> = <span style="color: #000000; font-weight: bold;">true</span>;<br />
<span style="color: #0000ff;">$cachedir</span> = <a href="http://www.php.net/dirname"><span style="color: #000066;">dirname</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'/cache'</span>;<br />
<span style="color: #0000ff;">$dir</span> = <a href="http://www.php.net/dirname"><span style="color: #000066;">dirname</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'/skins/default'</span>;</div><br />
Upload the combine.php script to the root of your website.<br />
<br />
<u>Step 2</u> You need to create or modify your .htaccess file. If you do not have a .htaccess file you can create it in the root of your website and add the following lines. If you already have an preexisting .htaccess file you can simply add the following lines to the file where you have to replace <span class="apache">default</span> with your current skin name:<br />
<br />
<div class="apache"><span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span><br />
<span style="color: #00007f;">RewriteBase</span> /<br />
<span style="color: #00007f;">RewriteRule</span> ^skins.*/default/<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span>^/<span style="color: #66cc66;">&#93;</span>+\.css|<span style="color: #66cc66;">&#91;</span>^/<span style="color: #66cc66;">&#93;</span>+\.js<span style="color: #66cc66;">&#41;</span>$ combine.php?<span style="color: #00007f;">files</span>=$<span style="color: #ff0000;">1</span></div><br />
<div class="note"><b>Note:</b> if your preexisting .htaccess file already uses URL rewriting you do not need to add the first two lines. You can simply add the last line to the bottom of the .htaccess file</div><br />
<u>Step 3</u> Change the js and css lines in your head.inc file in the admin area at "skin files" area to something like:<br />
<br />
<div class="html4strict"><span style="color: #009900;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;&lt;%skinfile(newstyle.css|nicetitle.css)%&gt;</span>&quot; /&gt;<br />
<br />
<span style="color: #009900;">&lt;script type=&quot;</span><span style="color: #000066;">text</span>/javascript<span style="color: #ff0000;">&quot; src=&quot;</span>&lt;%skinfile<span style="color: #66cc66;">&#40;</span>nicetitle.js|swfobject.js|popup.js<span style="color: #66cc66;">&#41;</span>%<span style="color: #000000; font-weight: bold;">&gt;</span></span>&quot;&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div><br />
<div class="note"><b>Note:</b> Of course you should use your own filenames</div><br />
]]></description>
 <category>Optimization</category>
<comments>http://wessite.com/item/2008/11/combining-and-compressing-javascript-and-css-files</comments>
 <pubDate>Sun, 23 Nov 2008 11:15:22 +0100</pubDate>
</item><item>
 <title>Caching Solutions for Nucleus CMS</title>
 <link>http://wessite.com/item/2008/11/caching-solutions-for-nucleus-cms</link>
<description><![CDATA[I have been using the Nucleus content management system for a few years, and I really like it. I once installed the Drupal on my Dreamhost server, and it was really slow compared to nucleus. The nucleus core is lightweight which makes it pretty fast, but not fast enough for my sluggish server though. It still makes a lot of SQL queries and has to read and parse templates which takes a lot of time. So how do we solve this problem you ask? One solution is; by caching your web page server side.<br />
<br />
There are 2 plugins available for caching that I know of:<br />
<br />
<ul><li><a href="http://wakka.xiffy.nl/cache">NP_Cache</a></li><li><a href="http://forum.nucleuscms.org/viewtopic.php?t=16040">NP_CacheLite</a></li></ul><br />
I never used the NP_CacheLite, but I took a look at the code and I didn't really like it. This plugin gives you the possibility of putting dynamic content between no cache tags in your skin, which means it still has to fetch your skin from your database. Maybe it's good for some websites, but not for this one.<br />
<br />
I went for the NP_Cache plugin, a fully cached solution for your website. Using a full cache of your web page is great but it comes with some glitches. Everything is static, this means the cache file has to be deleted every time a visitor comments on a item, or gives a rating, or when a user logs in for example. So everything which used to be dynamic has ceased to work. A few examples of plugins which won't work are NP_Captcha, NP_Views, NP_ Refer. You can address this issue by getting some dynamic content through an AJAX request.Below is my customized code for NP_Cache:<br />
<br />
<div class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> NP_Cache <span style="color: #000000; font-weight: bold;">extends</span> NucleusPlugin <span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$cache_dir</span> = <span style="color: #ff0000;">''</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getMinNucleusVersion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">155</span>; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getName<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">'Nucleus Cache'</span>; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getAuthor<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">'Jim Burnett | Wesley Luyten'</span>; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getURL<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">'http://www.mediauncut.com/'</span>; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getVersion<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">'1.1.01'</span>; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getDescription<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">'Enables caching of nucleus items, homepage, searches and anything off index.php.'</span>; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getEventList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'PreSkinParse'</span>,<span style="color: #ff0000;">'PostSkinParse'</span>,<span style="color: #ff0000;">'PostAddItem'</span>,<span style="color: #ff0000;">'PreUpdateItem'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> install<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">createOption</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'cache_dir'</span>,<span style="color: #ff0000;">'Enter the path (no trailing slash) of the cache directory: '</span>,<span style="color: #ff0000;">'text'</span>,<span style="color: #ff0000;">'/tmp'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache_dir</span> = <a href="http://www.php.net/trim"><span style="color: #000066;">trim</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">getOption</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'cache_dir'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">obStarted</span> = <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> event_PreSkinParse<span style="color: #66cc66;">&#40;</span>&amp;<span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/ob_start"><span style="color: #000066;">ob_start</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$bStart</span> = <span style="color: #cc66cc;">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// don't start output buffering if we're not at the top level</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// (fixes problems with RSS feeds &amp; ETAG)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/function_exists"><span style="color: #000066;">function_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'ob_get_level'</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/ob_get_level"><span style="color: #000066;">ob_get_level</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> &gt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$bStart</span> = <span style="color: #cc66cc;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bStart</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">obStarted</span> = <a href="http://www.php.net/ob_start"><span style="color: #000066;">ob_start</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;ob_gzhandler&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> event_PostAddItem<span style="color: #66cc66;">&#40;</span>&amp;<span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$blogid</span> = getBlogIDFromItemID<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'itemid'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = createItemLink<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'itemid'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">deleteCacheFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = createBlogidLink<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$blogid</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">deleteCacheFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> event_PreUpdateItem<span style="color: #66cc66;">&#40;</span>&amp;<span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$blogid</span> = getBlogIDFromItemID<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'itemid'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = createItemLink<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'itemid'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">deleteCacheFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = createBlogidLink<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$blogid</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">deleteCacheFile</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> deleteCacheFile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file_name</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">convertURL</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cache_file</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache_dir</span>.<span style="color: #ff0000;">'/cache-'</span>.<span style="color: #0000ff;">$file_name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #000066;">file_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache_file</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/unlink"><span style="color: #000066;">unlink</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache_file</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cache_file</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache_dir</span>.<span style="color: #ff0000;">'/cache-'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #000066;">file_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache_file</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/unlink"><span style="color: #000066;">unlink</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache_file</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> event_PostSkinParse<span style="color: #66cc66;">&#40;</span>&amp;<span style="color: #0000ff;">$data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$url</span> = <a href="http://www.php.net/getenv"><span style="color: #000066;">getenv</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'REQUEST_URI'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$file_name</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">convertURL</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$url</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$cache_file</span> = <span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">cache_dir</span>.<span style="color: #ff0000;">'/cache-'</span>.<span style="color: #0000ff;">$file_name</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if these string values occur in the url don't cache the page</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$dont_cache</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'php'</span>,<span style="color: #ff0000;">'action'</span>,<span style="color: #ff0000;">'query'</span>,<span style="color: #ff0000;">'catid'</span>,<span style="color: #ff0000;">'category'</span>,<span style="color: #ff0000;">'archive'</span>,<span style="color: #ff0000;">'gif'</span>,<span style="color: #ff0000;">'png'</span>,<span style="color: #ff0000;">'jpg'</span>,<span style="color: #ff0000;">'member'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str_ireplace<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dont_cache</span>,<span style="color: #ff0000;">''</span>,<span style="color: #0000ff;">$file_name</span>,<span style="color: #0000ff;">$count</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$count</span>==<span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!<span style="color: #0000ff;">$handle</span> = <a href="http://www.php.net/fopen"><span style="color: #000066;">fopen</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache_file</span>,<span style="color: #ff0000;">'w'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Cannot open file ($cache_file)&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/fwrite"><span style="color: #000066;">fwrite</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$handle</span>, <a href="http://www.php.net/ob_get_contents"><span style="color: #000066;">ob_get_contents</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> === <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;Cannot write to file ($cache_file)&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/ob_end_flush"><span style="color: #000066;">ob_end_flush</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> convertURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$a</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$CONF</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$replace</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$CONF</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'IndexURL'</span><span style="color: #66cc66;">&#93;</span>,<span style="color: #ff0000;">'/'</span>,<span style="color: #ff0000;">'&amp;'</span>,<span style="color: #ff0000;">'?'</span>,<span style="color: #ff0000;">'='</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$replace</span>,<span style="color: #ff0000;">''</span>,<span style="color: #0000ff;">$a</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div><br />
Notice the <span class="php"><span style="color: #0000ff;">$dont_cache</span></span> array. If a string value of the array occurs in the url of the web page the page won't be cached. You should alter this array to whatever fits you.<br />
<br />
You can download the customized plugin here: <a href="http://wessite.com/?file=1/NP_Cache.php.zip">NP_Cache</a><br />
<br />
<b>How to install and use the plugin?</b><br />
Download the plugin above and save it to a file called NP_Cache.php in your nucleus/plugins directory.<br />
<br />
<u>Step 1</u> Install NP_Cache.php from the Plugin Management page of the Nucleus admin area. After installing, edit the options for the NP_Cache plugin from that same page. Set the cache dir to match the absolute directory on your server. This directory must exist and must be writable by the web server. For Example: /home/myname/www.mysite.com/cache<br />
<br />
<u>Step 2</u> This is the code you want to add to the beginning of your root index.php and for each blog. Replace the “/home/myname/www.mysite.com/cache” with the same directory path you set in the plugin options, be sure to surround it in quotes. Add it directly after the &lt;?php line<br />
<br />
<div class="php"><span style="color: #0000ff;">$cache</span> = <span style="color: #ff0000;">'/home/myname/www.mysite.com/cache/cache-'</span>.<a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/'</span>,<span style="color: #ff0000;">'&amp;'</span>,<span style="color: #ff0000;">'?'</span>,<span style="color: #ff0000;">'='</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #ff0000;">''</span>,<a href="http://www.php.net/getenv"><span style="color: #000066;">getenv</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'REQUEST_URI'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #0000ff;">$t</span> = <span style="color: #cc66cc;">86400</span>; <span style="color: #808080; font-style: italic;">// cache files will be deleted every 1 day = 24*60*60</span><br />
<br />
<span style="color: #808080; font-style: italic;">// delete cache file when someone comments</span><br />
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_REQUEST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'action'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'addcomment'</span><span style="color: #66cc66;">&#41;</span> <a href="http://www.php.net/unlink"><span style="color: #000066;">unlink</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/file_exists"><span style="color: #000066;">file_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/time"><span style="color: #000066;">time</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #0000ff;">$t</span> &lt; <a href="http://www.php.net/filemtime"><span style="color: #000066;">filemtime</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <a href="http://www.php.net/file_get_contents"><span style="color: #000066;">file_get_contents</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt;!-- From cache generated '</span>.<a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'H:i'</span>,<a href="http://www.php.net/filemtime"><span style="color: #000066;">filemtime</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$cache</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">' by NP_Cache --&gt;'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #000066;">exit</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div><br />
<div class="leftbox"><a href="http://wessite.com/media/1/20081122-wessite_speed1.jpg" onclick="Foto(this.href, 'Speed Graph with NP_Cache plugin', '800', '417'); return false;"><img src="http://wessite.com/media/1/thumb_20081122-wessite_speed1.jpg" width="229" height="119" alt="Speed Graph with NP_Cache plugin" /></a></div>That's it, if everything went ok you will have a noticeable faster website. On the left is a speed graph of this website measured by Safari. The load time went from approximately 8.28 sec to 4.69 seconds with NP_Cache.]]></description>
 <category>Nucleus</category>
<comments>http://wessite.com/item/2008/11/caching-solutions-for-nucleus-cms</comments>
 <pubDate>Sat, 22 Nov 2008 19:59:15 +0100</pubDate>
</item><item>
 <title>Speeding Up your (Nucleus CMS) Web Site</title>
 <link>http://wessite.com/item/2008/11/speeding-up-your-nucleus-cms-web-site</link>
<description><![CDATA[I have been wanting to write this article for quite a time now, and today I found the time to do it. First off I want to say I'm not an expert or something when it comes to optimizing websites but I try to do my best, and share my thoughts and findings with you guys. This article will explain how I reduced the load time of this nucleus website from approximately  8.28 sec to 1.74 sec. Why is this important, well because:<br />
<br />
<div class="quote">Recent research shows that website users will not wait longer than 4 seconds for a website to load. After 4 seconds, customers will leave the site and seek an alternative site. Alarmingly, the research also shows that if a site fails to load within 4 seconds, users will be left with a negative brand perception.</div><br />
This website is served by the well known hosting service <a href="http://www.dreamhost.com/r.cgi?297983">DreamHost</a>. I have been very pleased with their services so far, they provide plenty web space and bandwidth for a blog (for sure) and their customer support is also awesome. The only lack is their servers aren't the fastest around especially when you make a lot of http requests and SQL queries, but hey what can you ask for such a low price.<div class="leftbox"><a href="http://wessite.com/media/1/20081122-wessite_speed0.jpg" onclick="Foto(this.href, 'Speed Graph without Optimization', '800', '417'); return false;"><img src="http://wessite.com/media/1/thumb_20081122-wessite_speed0.jpg" width="229" height="119" alt="Speed Graph without Optimization" /></a></div>I thought it would be better to split this article in a few parts because some of the methods that will be used are only for <a href="http://www.nucleuscms.org/">nucleus CMS</a> users and others are for all web designers. On the left you will see an image of the load time of my website without using any of the optimizing methods, it fully loaded in a time of 8.28 seconds (measured with Safari).<br />
<br />
<br />
<br />
The following links are the parts of the complete article:<br />
<br />
<ul><li><a href="http://wessite.com/item/2008/11/caching-solutions-for-nucleus-cms">Caching Solutions for Nucleus CMS</a></li><li><a href="http://wessite.com/item/2008/11/combining-and-compressing-javascript-and-css-files">Combining and Compressing Javascript and CSS Files</a></li><li><a href="http://wessite.com/item/2008/11/add-far-future-expires-headers">Add Far Future Expires Headers</a></li></ul><br />
Resources you should explore if you are serious about optimizing your website:<br />
<br />
<ul><li><a href="http://developer.yahoo.com/performance/rules.html">Best Practices for Speeding Up Your Web Site</a></li><li><a href="http://www.askapache.com/">AskApache Web Development</a></li></ul>]]></description>
 <category>Optimization</category>
<comments>http://wessite.com/item/2008/11/speeding-up-your-nucleus-cms-web-site</comments>
 <pubDate>Sat, 22 Nov 2008 17:59:00 +0100</pubDate>
</item><item>
 <title>Digg Like Time Ago PHP Function</title>
 <link>http://wessite.com/item/2008/11/digg-like-time-ago-php-function</link>
<description><![CDATA[A few days ago I was looking for a php function that showed the date/time format like on the site Digg (ex: 15 min 20 sec ago). I found two different php functions on the internet that almost achieved what I was looking for, at these links:<br />
<br />
<a href="http://woork.blogspot.com/2007/10/time-and-date-difference-using-php.html">woork.blogspot.com/2007/10/time-and-date-difference-using-php.html</a><br />
<a href="http://drupal.org/node/61565">drupal.org/node/61565</a><br />
<br />
But it wasn't exactly what I wanted so I wrote my own php function for it, check it out  below.<br />
<br />
<div class="php"><span style="color: #000000; font-weight: bold;">function</span> timeAgo<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$timestamp</span>, <span style="color: #0000ff;">$granularity</span>=<span style="color: #cc66cc;">2</span>, <span style="color: #0000ff;">$format</span>=<span style="color: #ff0000;">'Y-m-d H:i:s'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$difference</span> = <a href="http://www.php.net/time"><span style="color: #000066;">time</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #0000ff;">$timestamp</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$difference</span> &lt; <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #ff0000;">'0 seconds ago'</span>;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if difference is lower than zero check server offset</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">elseif</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$difference</span> &lt; <span style="color: #cc66cc;">864000</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// if difference is over 10 days show normal time form</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$periods</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'week'</span> =&gt; <span style="color: #cc66cc;">604800</span>,<span style="color: #ff0000;">'day'</span> =&gt; <span style="color: #cc66cc;">86400</span>,<span style="color: #ff0000;">'hr'</span> =&gt; <span style="color: #cc66cc;">3600</span>,<span style="color: #ff0000;">'min'</span> =&gt; <span style="color: #cc66cc;">60</span>,<span style="color: #ff0000;">'sec'</span> =&gt; <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">''</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$periods</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span> =&gt; <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$difference</span> &gt;= <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$time</span> = <a href="http://www.php.net/round"><span style="color: #000066;">round</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$difference</span> / <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$difference</span> %= <span style="color: #0000ff;">$value</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$output</span> .= <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$output</span> ? <span style="color: #ff0000;">' '</span> : <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #0000ff;">$time</span>.<span style="color: #ff0000;">' '</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$output</span> .= <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$time</span> &gt; <span style="color: #cc66cc;">1</span> &amp;&amp; <span style="color: #0000ff;">$key</span> == <span style="color: #ff0000;">'day'</span><span style="color: #66cc66;">&#41;</span> ? <span style="color: #0000ff;">$key</span>.<span style="color: #ff0000;">'s'</span> : <span style="color: #0000ff;">$key</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$granularity</span>--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$granularity</span> == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">break</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$output</span> ? <span style="color: #0000ff;">$output</span> : <span style="color: #ff0000;">'0 seconds'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #ff0000;">' ago'</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span> <a href="http://www.php.net/date"><span style="color: #000066;">date</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$format</span>, <span style="color: #0000ff;">$timestamp</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div>The first argument in the function is just a normal time stamp of your item which you probably fetch from your MySQL, the second "granularity" is how far you go in the precision of your date. For example:<br />
<br />
-granularity = 4 => 1day, 5hr, 23min, 12sec ago<br />
-granularity = 2 => 1day, 5hr ago<br />
<br />
The third parameter is the date format to be used when the time difference is over 10 days (notice the 864000 in the function, that's 10*24*60*60), so when the difference is 10 days or over the function shows the date in the format you choose. Of course you can change the 10 days in to whatever you like.<br />
<br />
You can download the php file here: <a href="http://wessite.com/?file=1/timeAgo.php.zip">PHP Time Ago Function</a><br />
<br />
<b>How to use it?</b><br />
<br />
Just include the timeAgo.php file in your PHP file that will use the function.<br />
<br />
<div class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">include</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'timeAgo.php'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div><br />
...and call the function when needed:<br />
<br />
<div class="php">timeAgo<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$dateRef</span><span style="color: #66cc66;">&#41;</span>;</div><br />
...where $dateRef is, for example, a value from a SQL query.<br />
<br />
]]></description>
 <category>PHP/MySQL</category>
<comments>http://wessite.com/item/2008/11/digg-like-time-ago-php-function</comments>
 <pubDate>Wed, 12 Nov 2008 15:07:42 +0100</pubDate>
</item><item>
 <title>Download FLV YouTube Easy in Safari</title>
 <link>http://wessite.com/item/2008/03/download-flv-youtube-easy-in-safari</link>
<description><![CDATA[Lately I have been seeing a lot of websites which you can use to retrieve the flv url of a <a href="http://www.youtube.com">YouTube</a> video. If you are browsing in a safari browser of apple it's actually very easy to get this url of the video file without using such a retrieval website. Because the addresses of everything which is downloaded to see an internet page is stored temporarily in the Activity monitor. Just click "window" in the upper menu of safari and choose "Activity monitor". Now a window will open, something like this:<br />
<br />
<a href="http://wessite.com/media/1/20080305-youtube.jpg">Safari&#039;s Activity Monitor</a><br />
<br />
Now just select the flv url, copy it, enter it in your browser url box and there you go. You can use this method on almost every flash video website for that matter. ]]></description>
 <category>Apple</category>
<comments>http://wessite.com/item/2008/03/download-flv-youtube-easy-in-safari</comments>
 <pubDate>Wed, 5 Mar 2008 04:42:00 +0100</pubDate>
</item><item>
 <title>Javascript Image Popup Script</title>
 <link>http://wessite.com/item/2008/03/javascript-image-popup-script</link>
<description><![CDATA[A while back I was searching on the internet for a decent photo popup script but I didn't find the one I was looking for. I started to code one of my own using bits and peaces of other scripts. This is the code I ended up with and I'm pretty satisfied with it. It is pretty simple and does the things I want it to do.<br />
<br />
<div class="javascript"><span style="color: #003366; font-weight: bold;">function</span> Foto<span style="color: #66cc66;">&#40;</span>img,txt,width,height<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; foto1 = document.<span style="color: #006600;">createElement</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'img'</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; foto1.<span style="color: #006600;">src</span> = img;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>!txt<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>txt=img<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; vars=<span style="color: #3366CC;">&quot;width=&quot;</span>+width+<span style="color: #3366CC;">&quot;,height=&quot;</span>+height+<span style="color: #3366CC;">&quot;,left=&quot;</span>+<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>screen.<span style="color: #006600;">width</span>-width<span style="color: #66cc66;">&#41;</span>/<span style="color: #CC0000;">2</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #3366CC;">&quot;,top=&quot;</span>+<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>screen.<span style="color: #006600;">height</span>-height<span style="color: #66cc66;">&#41;</span>/<span style="color: #CC0000;">2</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow=window.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span>,<span style="color: #3366CC;">&quot;newwindow&quot;</span>,vars<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #006600;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;html&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;head&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;title&gt;&quot;</span>+txt+<span style="color: #3366CC;">&quot;&lt;/title&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;meta http-equiv=<span style="color: #000099; font-weight: bold;">\&quot;</span>imagetoolbar<span style="color: #000099; font-weight: bold;">\&quot;</span> content=<span style="color: #000099; font-weight: bold;">\&quot;</span>no<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/head&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&lt;body style=<span style="color: #000099; font-weight: bold;">\&quot;</span>margin:0px; padding:0px; cursor:pointer;<span style="color: #000099; font-weight: bold;">\&quot;</span> onblur=<span style="color: #000099; font-weight: bold;">\&quot;</span>javascript:window.close();<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>+img+<span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> border=<span style="color: #000099; font-weight: bold;">\&quot;</span>0<span style="color: #000099; font-weight: bold;">\&quot;</span> onclick=<span style="color: #000099; font-weight: bold;">\&quot;</span>javascript:window.close();<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;/body&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;/html&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066;">focus</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066;">focus</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; newwindow.<span style="color: #006600;">document</span>.<span style="color: #000066;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span></div><br />
To use this script save this code in a file called popup.js or <a href="http://wessite.com/?file=1/popup.js">click here to download</a> it and upload it to your server with your favorite ftp client. The next step is to add a small piece of code to your head part of your page, something like this:<br />
<br />
<div class="html4strict"><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;/popup.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div><br />
Now you can add popup links to your pictures by using a link format like the following:<br />
<br />
<div class="html4strict"><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;/img/bigimage.jpg&quot;</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">&quot;Foto(this.href, 'My Photo Title', '800', '600'); return false;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Link<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span></div><br />
Notice the href attribute just points to the image url not a javascript function, so when a visitor who has javascript disabled clicks the link or thumbnail he will still go to the big image in the same window. This is also the case with the crawlers of search engines, so your images will still get indexed.]]></description>
 <category>Javascript</category>
<comments>http://wessite.com/item/2008/03/javascript-image-popup-script</comments>
 <pubDate>Tue, 4 Mar 2008 12:51:49 +0100</pubDate>
</item><item>
 <title>CSS Zebra Effect in Nucleus</title>
 <link>http://wessite.com/item/2008/03/css-zebra-effect-in-nucleus</link>
<description><![CDATA[Last month I wanted to make a zebra effect for the headlines list on my nucleus site bmxaction.net. I didn't find a plugin or something for it so I wrote a little script for it. It's actually really easy to get this effect.<br />
<br />
First I made a little zebra.php file with the following code:<br />
<br />
<div class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <br />
<a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$z</span>; <br />
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$z</span> % <span style="color: #cc66cc;">2</span> !== <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' class=&quot;zebra&quot;'</span>; <span style="color: #0000ff;">$z</span> = <span style="color: #cc66cc;">1</span>; <br />
<span style="color: #66cc66;">&#125;</span> <br />
<span style="color: #0000ff;">$z</span>++; <br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div><br />
To add the this in the iteration of my items I went to the my headline template and added this in a phpinclude tag like so:<br />
<br />
<div class="html4strict"><span style="color: #009900;">&lt;li&lt;%phpinclude<span style="color: #66cc66;">&#40;</span>zebra.php<span style="color: #66cc66;">&#41;</span>%<span style="color: #000000; font-weight: bold;">&gt;</span></span>&gt;<br />
<span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;date&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;">&lt;%date%<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span><br />
<span style="color: #009900;"><a href="http://december.com/html/4/element/h2.html"><span style="color: #000000; font-weight: bold;">&lt;h2&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;&lt;%itemlink%&gt;</span>&quot; title=&quot;Read entry: <span style="color: #009900;">&lt;%title(attribute)%&gt;</span>&quot;&gt;<span style="color: #009900;">&lt;%syndicate_title(50)%&gt;</span><span style="color: #009900;">&lt;/a&gt;</span><span style="color: #009900;">&lt;/h2&gt;</span><br />
<span style="color: #009900;">&lt;/li&gt;</span></span></div><br />
The last step is to add some css to make a difference in background:<br />
<br />
<div class="css"><span style="color: #6666ff;">.zebra</span><br />
<span style="color: #66cc66;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span>:<span style="color: #cc00cc;">#CCC</span>; <br />
<span style="color: #66cc66;">&#125;</span></div><br />
That's it! Now you have a cool zebra effect.<br />
]]></description>
 <category>Nucleus</category>
<comments>http://wessite.com/item/2008/03/css-zebra-effect-in-nucleus</comments>
 <pubDate>Mon, 3 Mar 2008 13:02:48 +0100</pubDate>
</item><item>
 <title>Welcome to wessite.com</title>
 <link>http://wessite.com/item/2008/02/welcome-to-wessitecom</link>
<description><![CDATA[First off, thank you for visiting my website and welcome. I am Wesley Luyten and I live in Belgium. I'm currently still in school and I'm learning for engineer ICT at the KHKempen in Geel. I'm starting this blog to write some news about what I am doing in my life, also post some scripts and tips to enhance your website.<br />
<br />
I also have a little portfolio on here to show the websites I already made in the past, which I'm still doing in my free time so if you need a website or help with one don't hesitate to send me a mail: info at wessite dot com.]]></description>
 <category>General</category>
<comments>http://wessite.com/item/2008/02/welcome-to-wessitecom</comments>
 <pubDate>Sun, 24 Feb 2008 05:33:16 +0100</pubDate>
</item>
  </channel>
</rss>