<?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>cakebaker &#187; jamal</title>
	<atom:link href="http://cakebaker.42dh.com/tags/jamal/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 20 Dec 2011 15:29:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Jamal Helper</title>
		<link>http://cakebaker.42dh.com/2007/05/01/jamal-helper/</link>
		<comments>http://cakebaker.42dh.com/2007/05/01/jamal-helper/#comments</comments>
		<pubDate>Tue, 01 May 2007 07:32:50 +0000</pubDate>
		<dc:creator>cakebaker</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[jamal]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/05/01/jamal-helper/</guid>
		<description><![CDATA[In the last few days I experimented again with the Javascript MVC framework Jamal. To make its usage a bit easier I wrote a simple helper (you can find it in the downloads section). As usual, you have to add the helper to the $helpers array of your controller(s) before you can use it: var [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few days I experimented again with the Javascript MVC framework <a href="http://jamal.moagil.de">Jamal</a>. To make its usage a bit easier I wrote a simple helper (you can find it in the <a href="http://cakebaker.42dh.com/downloads">downloads section</a>).</p>
<p>As usual, you have to add the helper to the $helpers array of your controller(s) before you can use it:</p>
<pre>
var $helpers = array('Jamal');
</pre>
<p>The helper provides two public methods: link() and set(). </p>
<p>The link() method is used in the head section of the layout to include all Jamal-related files. </p>
<pre>
echo $jamal->link();
</pre>
<p>If DEBUG is greater than 0, it creates something like:</p>
<pre>
&lt;script type="text/javascript" src="/js/src/jamal.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/js/src/models/example.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/js/src/plugins/metadata.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/js/src/controllers/examples_controller.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/js/src/views/examples.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/js/src/startup.js"&gt;&lt;/script&gt;
</pre>
<p>As soon as you switch DEBUG to 0, it will include the packed version of your scripts (you have to pack them &#8220;manually&#8221; with the Ant script that comes with Jamal):</p>
<pre>
&lt;script type="text/javascript" src="/js/dist/jamal_packed.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/js/dist/startup.js"&gt;&lt;/script&gt;
</pre>
<p>The second method, set(), is used to specify which (Javascript) controller action is executed when the respective view is loaded. So in the view you will do something like:</p>
<pre>
$jamal-&gt;set('MyController', 'myAction');
</pre>
<p>Additionally, you have to add the variable $jamal_for_layout to the body tag of your layout:</p>
<pre>
&lt;body &lt;?php echo $jamal_for_layout; ?&gt;&gt;
</pre>
<p>This will then generate the following code for Jamal:</p>
<pre>
&gt;body class="jamal {controller:'MyController',action:'myAction',debug:false}"&gt;
</pre>
<p>Happy baking with Jamal :)</p>
]]></content:encoded>
			<wfw:commentRss>http://cakebaker.42dh.com/2007/05/01/jamal-helper/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

