<?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>TechBytes &#187; Resources</title>
	<atom:link href="http://www.asim.pk/tag/resources/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.asim.pk</link>
	<description>Technology Bytes</description>
	<lastBuildDate>Fri, 20 Jan 2012 12:48:54 +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>CakePHP &#8211; link / include JavaScript files in layouts</title>
		<link>http://www.asim.pk/2008/12/29/cakephp-link-include-javascript-files-in-layouts/</link>
		<comments>http://www.asim.pk/2008/12/29/cakephp-link-include-javascript-files-in-layouts/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 08:37:04 +0000</pubDate>
		<dc:creator>Asim Zeeshan</dc:creator>
				<category><![CDATA[JavaScript Libraries]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Resources]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Include]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Layouts]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[Referencing]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.asim.pk/?p=131</guid>
		<description><![CDATA[Create (or modify the) file add this code CakePHP 1.2 allows you to define a reference to a Javascript file which is then added to the head section of the generated code. For this purpose the variable $scripts_for_layout has to &#8230; <a href="http://www.asim.pk/2008/12/29/cakephp-link-include-javascript-files-in-layouts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Create (or modify the) file</p>
<pre class="brush: plain; title: ; notranslate">app/app_controller.php</pre>
<p>add this code</p>
<pre class="brush: php; title: ; notranslate">
class AppController extends Controller {
	var $helpers = array('Html', 'Form', 'Javascript');
}
</pre>
<p><a href="http://cakephp.org/">CakePHP</a> 1.2 allows you to define a reference to a Javascript file which is then added to the head section of the generated code. For this purpose the variable $scripts_for_layout has to be added to the layout:</p>
<pre class="brush: php; title: ; notranslate">
&lt;head&gt;
	&lt; ?php echo $scripts_for_layout; ?&gt;
&lt;/head&gt;
</pre>
<p>In the view you can now link to the Javascript file with:</p>
<pre class="brush: php; title: ; notranslate">
$javascript-&gt;link('script.js', false);
// OR you can simply use $javascript-&gt;link('script.js');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.asim.pk/2008/12/29/cakephp-link-include-javascript-files-in-layouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

