<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kombat Koding</title>
	<atom:link href="http://kombatkoding.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kombatkoding.com</link>
	<description>Nuke Evolution Development and Support</description>
	<lastBuildDate>Sun, 01 Apr 2012 00:08:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Beware of Hash Table Attacks</title>
		<link>http://kombatkoding.com/beware-of-hash-table-attacks/</link>
		<comments>http://kombatkoding.com/beware-of-hash-table-attacks/#comments</comments>
		<pubDate>Sun, 01 Apr 2012 00:08:47 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=188</guid>
		<description><![CDATA[A few months ago, Alexander “alech” Klink and Julian “zeri” Wälde presented a report on how most web programming languages use hash tables to store data efficiently, and how this can be abused to force web applications to 99% CPU usage for several minutes with merely one request. The report highlights how in order to [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, Alexander “alech” Klink and Julian “zeri” Wälde <a href="http://events.ccc.de/congress/2011/Fahrplan/events/4680.en.html" target="_blank">presented a report</a> on how most web programming languages use <a title="Hash Table on Wikipedia" href="http://en.wikipedia.org/wiki/Hash_table" target="_blank">hash tables</a> to store data efficiently, and how this can be abused to force web applications to 99% CPU usage for several minutes with merely one request.</p>
<p>The report highlights how in order to minimise hash collisions in the event of brute force attacks, the DJBX33A and DJBX33X algorithm use a bit of resource intensive math to make the hashes longer. How could this be a bad thing?</p>
<h1>The Problem</h1>
<p>Knowing this, a list of values can be precompiled and all uploaded via GET or POST, forcing PHP (or any other interpreter) to compile these values into a hash table. Uploading only 1MB of these values at 70-100kbits per second is all that would be needed to keep an i7 CPU busy for a minute. Theoretically 8MB would take 288 minutes, DoSing the server with only one request.</p>
<h1>What can we do to protect ourselves?</h1>
<p>PHP natively comes with an <a title="post_max_size" href="http://www.php.net/manual/en/ini.core.php#ini.post-max-size" target="_blank">upload limit</a> of 8M, and a <a title="max_input_time" href="http://www.php.net/manual/en/info.configuration.php#ini.max-input-time" target="_blank">maximum time</a> for generating the hash table of 1 minute, which could be a worry for these kinds of attacks. When you consider that even these values allow for these kinds of attacks, it is a worry. However when taking into account functions such as user uploads, which may take considerable time for large files, it is hard to keep these limits down. However if working with PHP 5.3.8 and below, unfortunately it is all we have to work with.</p>
<p>Luckily in PHP 5.3.9, a new php.ini directive was introduced, <a title="max_input_vars" href="http://www.php.net/manual/en/info.configuration.php#ini.max-input-vars" target="_blank">max_input_vars</a>. By restricting the amount of variables that can be parsed into the table, the time spent generating the table is also limited. Defaulting at 1000, we can set this value much lower to only a little bit higher than the maximum amount of parameters we need on any given page in our applications. This should also apply to multidimensional inputs, after being highlighted in <a title="max_input_vars doesn't limit multi-dimensional arrays" href="https://bugs.php.net/bug.php?id=60728" target="_blank">this bug</a>.</p>
<p>Don&#8217;t take these directives light heartedly. Set them as low as you can afford, to prevent these attacks as well as you possibly can.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/beware-of-hash-table-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Theming TinyMCE in WordPress</title>
		<link>http://kombatkoding.com/theming-tinymce-in-wordpress/</link>
		<comments>http://kombatkoding.com/theming-tinymce-in-wordpress/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 23:43:53 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tinymce]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=178</guid>
		<description><![CDATA[I never liked writing up a blog post and clocking preview post, only to find that the post appeared totally different once the site theme has been applied. Thankfully, there&#8217;s a fairly simple fix that will make the visual editor show text very close to the format that will be applied on the main page. [...]]]></description>
			<content:encoded><![CDATA[<p>I never liked writing up a blog post and clocking preview post, only to find that the post appeared totally different once the site theme has been applied. Thankfully, there&#8217;s a fairly simple fix that will make the visual editor show text very close to the format that will be applied on the main page.</p>
<p>Firstly, find out what your theme&#8217;s main stylesheet is called, usually style.css. In your theme&#8217;s main directory, edit functions.php, and add the following code:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php add_editor_style('style.css'); ?&gt;</pre>
<p>Load up the page editor, it should resemble the post theme, however you may have a few problems, such as text right on the border, wrong text alignment, etc.</p>
<p>To fix this, add an entry to the bottom of your styles.css file similar to the following:</p>
<pre class="brush: css; title: ; notranslate">#tinymce { text-align:left; padding: 10px;}

#tinymce pre, #tinymce code { background: none repeat scroll 0 0 #EEEEEE; border: 1px solid #999999; }</pre>
<p>The above is what I have on this site fixing alignment and adding a background to distinguish the code boxes, but you can have any fixes you like to make the editor feel more real. Note that this method only works with the TinyMCE editor (WordPress 3.3) however is still possible to achieve with other css entries with earlier Version 3 installs.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/theming-tinymce-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merry Christmas</title>
		<link>http://kombatkoding.com/merry-christmas/</link>
		<comments>http://kombatkoding.com/merry-christmas/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 19:29:53 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=146</guid>
		<description><![CDATA[Just posting to let everyone know that I will not be online very much at all for the next few weeks as I am visiting my family for Christmas. I hope everyone has a safe and Merry Christmas and Happy New Year]]></description>
			<content:encoded><![CDATA[<p>Just posting to let everyone know that I will not be online very much at all for the next few weeks as I am visiting my family for Christmas.</p>
<p>I hope everyone has a safe and Merry Christmas and Happy New Year <img src='http://cdn.kombatkoding.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/merry-christmas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Graphing Plugin &#8211; jqPlot</title>
		<link>http://kombatkoding.com/jquery-graphing-plugin-jqplot/</link>
		<comments>http://kombatkoding.com/jquery-graphing-plugin-jqplot/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 22:35:17 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[jqplot]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plot]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=128</guid>
		<description><![CDATA[I was recently looking for a nice graphing plugin to create some monthly charts for on the homepage of the Donations Xtreme admin panel, instead of the messy overview that it currently uses. While all of the plugins that I found created charts, they just didn&#8217;t have the nice feel that I was after. I [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently looking for a nice graphing plugin to create some monthly charts for on the homepage of the Donations Xtreme admin panel, instead of the messy overview that it currently uses. While all of the plugins that I found created charts, they just didn&#8217;t have the nice feel that I was after. I then found <a href="http://www.jqplot.com/">jqPlot</a>, which instantly sat above the rest. The charts created by this plugin just plain look better.</p>
<p>The thing that amazed me with jqPlot is the amount of plugins that came with it to do different things. So many different types of charts can be created using this plugin, but by using plugins, the code remains nice and quick, and you only load what you are going to need. And there areplugins for added functionality too. For example you can add trend lines, add a tooltip for where the cursor is, or load external data via ajax.</p>
<h2>Creating Graphs</h2>
<p>It is easy to use also. After uploading the files you need, all you have to add to your header is:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;jquery.jqplot.min.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;jquery.jqplot.min.css&quot; /&gt;</pre>
<p>And were ready to start making pretty graphs <img src='http://cdn.kombatkoding.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If we add a div to our page to contain the chart:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;chart_container&quot; style=&quot;height:400px;width:600px; &quot;&gt;&lt;/div&gt;
</pre>
<p>Then we can add the chart generating code to our onload event:</p>
<pre class="brush: jscript; title: ; notranslate">
window.onload=function(){
	$.jqplot('chart_container',  [[[1, 2],[2,4],[3,8],[4,16],[5,32],[6,64]]]);
}
</pre>
<p>And we end up with a nice graph like below.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-133" title="Simple Graph" src="http://cdn.kombatkoding.com/wp-content/uploads/2011/10/graph1.png" alt="" width="603" height="402" /></p>
<h2>Customising the Graphs</h2>
<p>To make it look a little nicer, we can add a title, axis titles, change colours, change data point markers, pretty much anything we want. For a full list of options, see the core summary at <a href="http://www.jqplot.com/docs/files/jqplot-core-js.html">http://www.jqplot.com/docs/files/jqplot-core-js.html</a>. A simple example is shown below:</p>
<pre class="brush: jscript; title: ; notranslate">
window.onload=function(){
	$.jqplot('chart_container',  [[[1, 2],[2,4],[3,8],[4,16],[5,32],[6,64]]], {
		title:'Simple jqPlot Example',
		axes:{
			xaxis:{label:'x'},
			yaxis:{min:0, max:75,label:'y'}
		},
		series:[{
			color:'#00cc00',
			label:'y=2^x',
			markerOptions:{style:'filledSquare'}
		}],
		legend:{
			show: true,
			location:'se'
		}
	});
}
</pre>
<p>Which will give the following more user friendly graph.</p>
<p><img class="aligncenter size-full wp-image-134" title="Customised Simple Graph" src="http://cdn.kombatkoding.com/wp-content/uploads/2011/10/graph2.png" alt="" width="608" height="406" /></p>
<p>I really like this plugin, the graphs look nice and they easily beat tables of data. To get an idea of what is really possible with <a href="http://www.jqplot.com/">jqPlot</a>, check out the <a href="http://www.jqplot.com/tests/">example page</a> or <a href="https://bitbucket.org/cleonello/jqplot/downloads/">download the source</a>, and check out the examples folder. It is amazing just how much this plugin can do.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/jquery-graphing-plugin-jqplot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coding 4 Xtreme</title>
		<link>http://kombatkoding.com/coding-4-xtreme/</link>
		<comments>http://kombatkoding.com/coding-4-xtreme/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 10:05:49 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[Nuke Evolution]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[xtreme]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=115</guid>
		<description><![CDATA[Hi everyone, welcome to the start of a series of posts on development for the open source CMS Evolution Xtreme. This series is going to go through the basics of creating modules, starting at basic folder structure and going right through to user interaction and submissions. While you will hopefully learn something from going through [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everyone, welcome to the start of a series of posts on development for the open source CMS Evolution Xtreme. This series is going to go through the basics of creating modules, starting at basic folder structure and going right through to user interaction and submissions.</p>
<p>While you will hopefully learn something from going through my code examples, where you will take off is trying to adapt the code to your own creations. Nothing works better than &#8220;just doing it.&#8221; If you have any questions at all, please, feel free to ask.</p>
<p>I&#8217;m going to be assuming you have a basic understanding of PHP and HTML, and Evolution Xtreme installed. I recommend that you use a server such as WampServer on your computer rather than online, as it will make editing much easier.</p>
<p>Throughout this series, we will be making a fairly basic &#8220;Inspirational Quotes&#8221; module. It will start as a basic page which will output a random quote specified in the module file, and will finish with an admin panel and database usage, catering for user submissions and permissions.</p>
<p>The plan is as follows:</p>
<ul>
<li>Post 2 &#8211; Module structure</li>
<li>Post 3 &#8211; Using the database</li>
<li>Post 4 &#8211; Creating an admin page</li>
<li>Post 5 &#8211; Creating blocks</li>
<li>Post 6 &#8211; User interaction</li>
<li>Post 7 &#8211; Tidying up</li>
</ul>
<p>Still interested? Let&#8217;s get started.</p>
<p>Before we dive into our module, I want to explain the most common aspects to starting any module. They are access validation and the <em>header.php</em> and <em>footer.php</em> files.</p>
<p><strong>Access validation</strong><br />
These few lines check to see if the module file is being accessed directly rather than through modules.php. Since this is generally not desirable, and only possible if a hacker is looking through files, we simply end on an error message</p>
<p><strong>header.php and footer.php</strong><br />
These files output the header and footer of the page in the theme that the site/user specify. Without these, modules will just appear on a blank background.</p>
<p>For the vast majority of modules, these files are used, and even for the rest, slightly adapted versions of these files are used. They are the fundamentals of creating modules, so get ready to include them in every one you make.</p>
<p>In the next post, I will go through the folder structure of the module, output, and basically just creating something that the user can see. Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/coding-4-xtreme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on DX:HR</title>
		<link>http://kombatkoding.com/thoughts-on-dxhr/</link>
		<comments>http://kombatkoding.com/thoughts-on-dxhr/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 10:59:21 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[Featured Posts]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Deus Ex]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=83</guid>
		<description><![CDATA[I have been waiting for this game to be released for a little over a year now, since I saw it on the front cover of Atomic magazine. And I have to say, it has definitely been worth the wait. Even though it was released in 2000, last week, I would have still said that [...]]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://www.youtube.com/embed/XUd9CLRj5fY" frameborder="0" width="560" height="345"></iframe></p>
<p>I have been waiting for this game to be released for a little over a year now, since I saw it on the front cover of Atomic magazine. And I have to say, it has definitely been worth the wait.</p>
<p>Even though it was released in 2000, last week, I would have still said that my absolute No. 1 favourite campaign was in the original Deus Ex game. But as of Thursday, that has changed. I havent yet finished campaign, bu in my opinion, Deus Ex Human Revolution has gone above and topped it.</p>
<p>The best part of the game is how suspenseful it can be. For example you have to creep slowly through an area littered  with guards, hoping that they don&#8217;t hear you. But while stealth elements of the game have been done really well, there is still the choice of making some noise, hoping that you have enough ammo or objects around you. And if that fails, there&#8217;s always the option of throwing objects at enemies. There&#8217;s nothing funnier than killing a big scary boss with a fire extinguisher thrown to the head <img src='http://cdn.kombatkoding.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>The most surprising part about the game is how real it feels. For example while roaming the streets of Shanghai, you may run across small food shops, with the shopkeeper cooking food and people eating at the bench. If you watch, the shop keeper is actually cooking &#8211; throwing in ingredients, stirring, and turning whatever is in the pan over a stove. Small things like this, they all add up, creating a convincing environment which could easily be the world in 16 years.</p>
<p>If you haven&#8217;t already, I suggest you obtain Deus Ex Human Revolution. It is an amazing game, and definitely worth the money to buy it.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/thoughts-on-dxhr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a fast templating class</title>
		<link>http://kombatkoding.com/creating-a-fast-templating-class/</link>
		<comments>http://kombatkoding.com/creating-a-fast-templating-class/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 02:49:09 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[lightweight]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://kombatkoding.com/?p=70</guid>
		<description><![CDATA[It is often easier when creating something pretty much from scratch to use some form of templating system rather than mixing layout and logic. It just makes things easier to work with. Several packages exist, such as Smarty, but why add so much bloat and slow down your code in order to do so? Additional [...]]]></description>
			<content:encoded><![CDATA[<p>It is often easier when creating something pretty much from scratch to use some form of templating system rather than mixing layout and logic. It just makes things easier to work with. Several packages exist, such as Smarty, but why add so much bloat and slow down your code in order to do so? Additional syntax has to be parsed, which costs time. PHP will suffice, especially if it is you who will be working with it.</p>
<p>Instead, here is how you can create a lightweight templating class, which is easy to use and practically unnoticable in the load times.</p>
<p><strong>The Code</strong></p>
<p>We want to create our class, and be able to specify the template directory upon initialisation. We need two variables, one for the template path, and one for the template variables.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

class template_engine{

	public $tpl_data;
	public $tpl_dir;

	function __contruct($dir){
		$this-&gt;tpl_dir = $dir;
	}

}
</pre>
<p>Now we need a way to add our template variables. Nothing fancy for now, we will improve upon this later in the tutorial</p>
<pre class="brush: php; title: ; notranslate">function assign($var, $value=null){
	if ($var != ''){
		$this-&gt;tpl_data[$var] = $value;
	}
</pre>
<p>And we want a way to display a template file using the given template vaiables.</p>
<pre class="brush: php; title: ; notranslate">function display($template_file){
	if (!empty($this-&gt;tpl_data)){
		extract($this-&gt;tpl_data, EXTR_REFS);
	}
	include($this-&gt;tpl_dir.$template_file);
}
</pre>
<p>This will allow us to use plain variable names inside the template files as shown below. Note we do not have to unset the variables as they will all be taken care of at the end of the function thanks to PHP&#8217;s garbage collection.</p>
<pre class="brush: php; title: ; notranslate">&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta charset=&quot;utf-8&quot;&gt;
&lt;title&gt;&lt;?php echo $site_name; ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;header&gt;
	&lt;h1&gt;Welcome to the &lt;?php echo $tut_title; ?&gt; Tutorial brought to you by &lt;?php echo $site_name; ?&gt;&lt;/h1&gt;
&lt;/header&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>If this is saved as <em>main.php</em> in the <em>templates/</em> folder relative to the main file, <em>index.php</em>, we can call the template as follows</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

include 'template.class.php';
$tpl = new template_engine('templates/');

$tpl-&gt;assign('site_name', 'Kombat Koding');
$tpl-&gt;assign('tut_title', 'Lightweight Template Class');

$tpl-&gt;display('main.php');
</pre>
<p>And it will output &#8220;<em>Welcome to the Lightweight Template Class Tutorial brought to you by Kombat Koding</em>&#8220;.</p>
<p>Too easy, right?</p>
<p><strong>Some more advanced features</strong></p>
<p>At the moment, the class is pretty basic. We can add many more features, but keep in mind we dont want to bloat the class.</p>
<p>Ive added the ability to assign multiple variables at a time, an append function for adding to arrays assigned to the class, a clear variables function, and a function to fetch the template rather than outputting it straight away. I wont be going through the code for these functions, but I will supply the final class and usage below.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php

class template_engine{

	public $tpl_data;
	public $tpl_dir;

	function __contruct($dir){
		$this-&gt;tpl_dir = $dir;
	}

	function assign($var, $value=null){
		if (is_array($var)){
			foreach ($var as $key=&gt;$val){
				if ($key != '') {
					$this-&gt;tpl_data[$key] = $val;
				}
			}
		}else{
			if ($var != ''){
				$this-&gt;tpl_data[$var] = $value;
			}
		}
	}

	function append($var, $value=null){
		if (is_array($var)){
            foreach($var as $key=&gt;$val){
                if ($key != ''){
                    if (!@is_array($this-&gt;tpl_data[$key])){
            			settype($this-&gt;tpl_data[$key],'array');
            		}
					$this-&gt;tpl_data[$key][] = $val;
                }
            }
        }else{
            if ($var != ''){
            	if (!isset($this-&gt;tpl_data[$var])){
					$this-&gt;tpl_data[$var] = array();
				}elseif (!@is_array($this-&gt;tpl_data[$var])){
            		settype($this-&gt;tpl_data[$var],'array');
            	}
            	$this-&gt;tpl_data[$var][] = $value;
			}
        }
	}

	function clear_variables($var=false){
		if (!empty($var)){
			if (is_array($var)){
            	foreach($var as $v){
            		unset($this-&gt;tpl_data[$v]);
            	}
			}else{
            	unset($this-&gt;tpl_data[$var]);
        	}
		}else{
			$this-&gt;tpl_data = array();
		}
	}

	function display($template_file){
		if (!empty($this-&gt;tpl_data)){
			extract($this-&gt;tpl_data, EXTR_REFS);
		}

		include($this-&gt;tpl_dir.$template_file);
	}

	function fetch($template_file){
		if (!empty($this-&gt;tpl_data)){
			extract($this-&gt;tpl_data, EXTR_REFS);
		}
		ob_start();
		include($this-&gt;tpl_dir.$template_file);
		return ob_get_clean();
	}
}

?&gt;</pre>
<p>Usage Examples(from forums mobile mod):</p>
<pre class="brush: php; title: ; notranslate">$tpl-&gt;assign(array(
	'forum_id' =&gt; $forum_id,
	'forum_name' =&gt; $row['forum_name']
));
</pre>
<p>&nbsp;</p>
<pre class="brush: php; title: ; notranslate">$res = $db-&gt;sql_query('SELECT p.`privmsgs_id`, p.`privmsgs_type`, p.`privmsgs_subject`, p.`privmsgs_from_userid`, p.`privmsgs_date`, u.`username` FROM `'. PRIVMSGS_TABLE.'` AS p LEFT JOIN `'. USERS_TABLE .'` AS u ON p.`privmsgs_from_userid`=u.`user_id` WHERE p.`privmsgs_to_userid`='.$userinfo['user_id'].' AND p.`privmsgs_type` IN ('. PRIVMSGS_READ_MAIL .','. PRIVMSGS_NEW_MAIL .','. PRIVMSGS_UNREAD_MAIL .') ORDER BY p.`privmsgs_date` DESC LIMIT '.($page*$show).','.$show);
	while($row = $db-&gt;sql_fetchrow($res)){
		$tpl-&gt;append('msgs',array(
			'id' =&gt; $row['privmsgs_id'],
			'type' =&gt; $row['privmsgs_type'],
			'subject' =&gt; $row['privmsgs_subject'],
			'from' = &gt;$row['privmsgs_from_userid'],
			'from_username' =&gt; $row['username'],
			'date' =&gt; EvoDate($userinfo['user_dateformat'], $row['privmsgs_date'], $userinfo['user_timezone']),
			'username' =&gt; $row['username']
		));
	}
}

$tpl-&gt;display('private_messages.php');
</pre>
<p>I hope that this tutorial or code is useful to you in some way. It is very easy to plug the code into any new project, and can make layout changes during the development phase 100 times easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/creating-a-fast-templating-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Little bit of a dilemma</title>
		<link>http://kombatkoding.com/little-bit-of-a-dilemma/</link>
		<comments>http://kombatkoding.com/little-bit-of-a-dilemma/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 10:07:06 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://localhost/kk/?p=60</guid>
		<description><![CDATA[I have a little bit of a dilemma, so I&#8217;m just gonna put it out in the open and see if anyone has anything to say about it. I&#8217;ll admit it, I don&#8217;t know very much about HTML5 or CSS3. I still naturally code in XHTML, but after seeing SgtLegend put together both the Mobile [...]]]></description>
			<content:encoded><![CDATA[<p>I have a little bit of a dilemma, so I&#8217;m just gonna put it out in the open and see if anyone has anything to say about it.</p>
<p>I&#8217;ll admit it, I don&#8217;t know very much about HTML5 or CSS3. I still naturally code in XHTML, but after seeing SgtLegend put together both the Mobile Mod and BB3 to Xtreme converter themes so simply and quickly using these two languages, I really want to learn, and let both myself and my code benefit from the two. However learning languages takes time&#8230; Time that I would normally spend making things would be instead spent reading, testing, doing basic themes, etc&#8230; Which I&#8217;m not sure I can even be bothered enduring right now.</p>
<p>So what do you guys think? Keep pushing it aside, or bite the bullet and get it over and done with?</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/little-bit-of-a-dilemma/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Might be around a little less</title>
		<link>http://kombatkoding.com/might-be-around-a-little-less/</link>
		<comments>http://kombatkoding.com/might-be-around-a-little-less/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 07:58:08 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://localhost/kk/?p=58</guid>
		<description><![CDATA[Well, its that time again, uni is starting back up, so I&#8217;m, preparing for a massive amount of homework. Instead of working and doing part time uni, I will be completing full time uni for the next semester. This means more homework, which I am definitely not looking forward to, but at the same time, [...]]]></description>
			<content:encoded><![CDATA[<p>Well, its that time again, uni is starting back up, so I&#8217;m, preparing for a massive amount of homework.</p>
<p>Instead of working and doing part time uni, I will be completing full time uni for the next semester. This means more homework, which I am definitely not looking forward to, but at the same time, I will not be working, so there is a chance that I will have more time.</p>
<p>Guess we&#8217;ll just have to wait and see&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/might-be-around-a-little-less/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Mod</title>
		<link>http://kombatkoding.com/mobile-mod/</link>
		<comments>http://kombatkoding.com/mobile-mod/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 09:35:19 +0000</pubDate>
		<dc:creator>travo</dc:creator>
				<category><![CDATA[Nuke Evolution]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[lite]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[mod]]></category>

		<guid isPermaLink="false">http://localhost/kk/?p=50</guid>
		<description><![CDATA[It was a fairly normal Friday, I got home from work, came online, spoke to SgtLegend, and before we knew it,we were slaughtering zombies in L4D2. All of a sudden, we were rudely interrupted by an Xtreme user, Malius, wondering if there would be any chance of a mobile mod for Xtreme. Now, we had [...]]]></description>
			<content:encoded><![CDATA[<p>It was a fairly normal Friday, I got home from work, came online, spoke to SgtLegend, and before we knew it,we were slaughtering zombies in L4D2. All of a sudden, we were <em>rudely</em> interrupted by an Xtreme user, Malius, wondering if there would be any chance of a mobile mod for Xtreme.</p>
<p>Now, we had both discussed a mobile mod before, and both agreed that it would take a hell of a lot of work to get it working properly. However we both had a very similar idea pop into our heads at the same time &#8211; use Nuke&#8217;s core and a custom templating system to create a lite version of the forums. The mod would only cover reading, posting, and some account features, eliminating the complications of introducing modules, other mods, etc. A couple of hours, few coffees and a lightweight HTML5/CSS3 theme away, Forums Mobile was born.</p>
<p>As of right now, the mod covers logging in and out, browsing through forums and posts, reading PMs, and has support for other themes to be made, and not a single line of configuration is to be found&#8230; it merely drops straight into your <em>modules/</em> folder and is ready to use.</p>
<p>While it is not quite ready yet, at the rapid pace we are currently making, hopefully it wont be too long before the mod is ready for use on all Xtreme sites.</p>
<p>&nbsp;</p>
<p>For anyone further interested in the topic of Xtreme going mobile, as seen in SgtLegend&#8217;s post <a href="http://www.evolution-xtreme.com/modules.php?name=Forums&amp;file=viewtopic&amp;p=29814" target="_blank">here</a> and mentioned on his blog, the <a href="http://www.tapatalk.com/" target="_blank">Tapatalk</a> mobile app is considered for inclusion in Evolution Xtreme 2.0.9e.</p>
]]></content:encoded>
			<wfw:commentRss>http://kombatkoding.com/mobile-mod/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Content Delivery Network via cdn.kombatkoding.com

Served from: kombatkoding.com @ 2012-05-21 13:05:00 -->
