<?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>JavaScriptr &#187; HTML/XHTML</title>
	<atom:link href="http://www.javascriptr.com/category/html-xhtml/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javascriptr.com</link>
	<description>A blog about JavaScript and other web development technologies</description>
	<lastBuildDate>Sun, 20 Sep 2009 19:36:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PureJSTemplate  &#8211; A pure javascript templating engine for jQuery</title>
		<link>http://www.javascriptr.com/2008/06/05/purejstemplate-a-pure-javascript-templating-engine-for-jquery/</link>
		<comments>http://www.javascriptr.com/2008/06/05/purejstemplate-a-pure-javascript-templating-engine-for-jquery/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 01:32:31 +0000</pubDate>
		<dc:creator>mo rock</dc:creator>
				<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[PureJSTemplate]]></category>
		<category><![CDATA[templating]]></category>

		<guid isPermaLink="false">http://www.javascriptr.com/2008/06/05/purejstemplate-a-pure-javascript-templating-engine-for-jquery/</guid>
		<description><![CDATA[Most templating languages suck Ok, if your like me then you hate all templating langauges- they suck, they really suck. I hate them because I hate the rules they enforce upon me, they are slow, and they slow me down. Because of this, usually I end up making code that looks like this: UGLY: 1 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Most templating languages suck </strong></p>
<p>Ok, if your like me then you hate all templating langauges- they suck, they really suck. I hate them because I hate the rules they enforce upon me, they are slow, and they slow me down. Because of this, usually I end up making code that looks like this:</p>
<p><strong>UGLY: </strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> display<span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> output <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&lt;div&gt;&quot;</span> <span style="color: #339933;">+</span> data.<span style="color: #660066;">text</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
   element.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>output<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>How horrible is that? That&#8217;s probably worse than using a bad templating langauge.</p>
<p>Well, after disappointments with other jQuery templating plugins, I decided to make my own<span id="more-14"></span>:</p>
<p><strong>The Solution: PureJSTemplate </strong></p>
<p>With PureJSTemplate you use old fashioned javascript in your template. You simply surround the javascript in special tags. Here&#8217;s an example of what you can do:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span># <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> #<span style="color: #339933;">&gt;</span>
   <span style="color: #339933;">&lt;</span>#<span style="color: #339933;">=</span>i#<span style="color: #339933;">&gt;&lt;</span>br<span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>#<span style="color: #009900;">&#125;</span>#<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>That will output the numbers 0 through 9. Easy, isn&#8217;t it?</p>
<p><strong>Using it: </strong></p>
<p>You simply surround your template code with a textarea tag:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;textarea</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tpl&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;display:none&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- TEMPLATE CODE HERE --&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/textarea<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>and call it from javascript like so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;output&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">pureJSTemplate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
   id   <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;tpl&quot;</span><span style="color: #339933;">,</span>
   data <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>That&#8217;s it.</p>
<p><strong> Get the Code: </strong></p>
<p>Visit a demo/benchmark page <a href="http://www.glicky.com/downloads/testtemplating_jquery.html" title="demo">here</a>. Get the js <a href="http://www.glicky.com/downloads/purejstemplate_jquery.js" title="js">here</a>.<br />
<</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javascriptr.com/2008/06/05/purejstemplate-a-pure-javascript-templating-engine-for-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning Adobe Air</title>
		<link>http://www.javascriptr.com/2007/12/19/learning-adobe-air/</link>
		<comments>http://www.javascriptr.com/2007/12/19/learning-adobe-air/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 23:26:13 +0000</pubDate>
		<dc:creator>Henry B.</dc:creator>
				<category><![CDATA[Adobe Air]]></category>
		<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Quick Link]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.javascriptr.com/2007/12/19/learning-adobe-air/</guid>
		<description><![CDATA[Jonathan Snook has a great article on 24ways.org about creating an Adobe Air application using JavaScript, HTML and CSS. This is a great way for web developers who don&#8217;t know much or don&#8217;t care about Flash to get started. I&#8217;d like to push this further by creating a desktop app that can also live on [...]]]></description>
			<content:encoded><![CDATA[<p>Jonathan Snook has a great article on <a href="http://24ways.org" target="_blank">24ways.org</a> about creating an Adobe Air application using JavaScript, HTML and CSS. This is a great way for web developers who don&#8217;t know much or don&#8217;t care about Flash to get started.</p>
<p>I&#8217;d like to push this further by creating a desktop app that can also live on the web. Maybe even communicate with the desktop version.</p>
<p>You can check out <a href="http://24ways.org/2007/christmas-is-in-the-air" target="_blank">Snook&#8217;s article here</a>.<br />
<</p>
]]></content:encoded>
			<wfw:commentRss>http://www.javascriptr.com/2007/12/19/learning-adobe-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
