<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>anupom.toString( ); &#187; CakePHP</title>
	<atom:link href="http://anupom.wordpress.com/category/cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://anupom.wordpress.com</link>
	<description>Web Development, Java, PHP, Ruby, Javascript and many more!</description>
	<lastBuildDate>Sat, 12 Sep 2009 05:44:32 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='anupom.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/3ff710d3ac1d9a52305c62be6e59c22a?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>anupom.toString( ); &#187; CakePHP</title>
		<link>http://anupom.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://anupom.wordpress.com/osd.xml" title="anupom.toString( );" />
		<item>
		<title>RSS in CakePHP 1.2</title>
		<link>http://anupom.wordpress.com/2008/03/12/rss-in-cakephp-12/</link>
		<comments>http://anupom.wordpress.com/2008/03/12/rss-in-cakephp-12/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 18:30:55 +0000</pubDate>
		<dc:creator>anupom</dc:creator>
				<category><![CDATA[Cake]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[CakePHP RSS]]></category>

		<guid isPermaLink="false">http://anupom.wordpress.com/?p=53</guid>
		<description><![CDATA[We all know what is RSS and how it looks like, here goes simple sample –
 
&#60;?xml version=&#34;1.0&#34;?&#62; 
  &#60;rss version=&#34;2.0&#34;&#62; 
  &#160; &#60;channel&#62;
  &#160;&#160;&#160; &#60;title&#62;Channel Title&#60;/title&#62;
  &#160;&#160;&#160; &#60;link&#62;http://www.example.com/&#60;/link&#62;
  &#160;&#160;&#160;  &#60;description&#62;Channel Description&#60;/description &#62; 
  &#160;&#160;&#160; &#60;item&#62;
  &#160;&#160;&#160;&#160;&#160; &#60;title&#62;title1&#60;/title&#62;
  &#160;&#160;&#160;&#160;&#160; &#60;link&#62;http://www.example.com/link1&#60;/link&#62;
  &#160;&#160;&#160;&#160;&#160; &#60;description&#62;description1&#60;/description&#62;
  &#160;&#160;&#160;&#160;&#160; &#60;pubDate&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=53&subd=anupom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We all know what is RSS and how it looks like, here goes simple sample –</p>
<p><code> </p>
<p>&lt;?xml version=&quot;1.0&quot;?&gt; <br />
  &lt;rss version=&quot;2.0&quot;&gt; <br />
  &nbsp; &lt;channel&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;title&gt;Channel Title&lt;/title&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;link&gt;http://www.example.com/&lt;/link&gt;<br />
  &nbsp;&nbsp;&nbsp;  &lt;description&gt;Channel Description&lt;/description &gt; <br />
  &nbsp;&nbsp;&nbsp; &lt;item&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;title1&lt;/title&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;link&gt;http://www.example.com/link1&lt;/link&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;description&gt;description1&lt;/description&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pubDate&gt; &lt;/pubDate&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;guid&gt;http://www.example.com/guid1&lt;/guid&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;/item&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp; &lt;item&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;title2&lt;/title&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;link&gt;http://www.example.com/link2&lt;/link&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;description&gt; description2&lt;/description&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pubDate&gt; &lt;/pubDate&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;guid&gt;http://www.example.com/guid2&lt;/guid&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;/item&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;item&gt; <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;title&gt;title3&lt;/title&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;link&gt;http://www.example.com/link3&lt;/link&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;description&gt;description3&lt;/description&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;pubDate&gt; &lt;/pubDate&gt;<br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;guid&gt;http://www.example.com/guid3&lt;/guid&gt;<br />
  &nbsp;&nbsp;&nbsp; &lt;/item&gt;<br />
  &nbsp; &lt;/channel&gt;<br />
  &lt;/rss&gt; </p>
<p></code></p>
<p>Creating RSS feed like the above is petty easy with the CakePHP1.2’s RSSHelper. Using the RSSHelper and with the help of the RequestHandler component, we can serve both RSS and (X)HTML content from a single controller action. It is pretty easy to plug in RSS feeds to an already written controller action that serves (X)HTML.</p>
<p>Let’s assume we want to add RSS feeds for the following controller action (PostsController/index) –</p>
<p><code>function index() {<br />
       $this-&gt;Post-&gt;recursive = 1;<br />
      //get all posts<br />
      $posts = $this-&gt;Post-&gt;find(‘all’);<br />
      $this-&gt;set(‘posts’, $posts);<br />
     //set the title<br />
      $this-&gt;setTitleForLayout(‘All Posts’);<br />
}</code></p>
<p>Also, assume that $this-&gt;Post-&gt;find(‘all’) call return an array like the following,</p>
<p><code>$post[0]['Post']['id'] = 1;<br />
$post[0]['Post']['title'] = 'title1';<br />
$post[0]['Post']['body'] = 'description1';<br />
$data[0]['User']['name'] = 'author1';<br />
$post[0]['Post']['modified'] = '2008-1-1';<br />
$data[1]['Post']['id'] = 2;<br />
$data[1]['Post']['title'] = 'title2';<br />
$data[1]['Post']['body'] = ''description2;<br />
$data[1]['User']['name'] = 'author2';<br />
$data[1]['Post']['modified'] = '2008-1-21';<br />
$data[2]['Post']['id'] = 3;<br />
$data[2]['Post']['title'] = 'title3';<br />
$data[2]['Post']['body'] = ''description3';<br />
$data[2]['User']['name'] = 'author 3';<br />
$data[2]['Post']['modified'] = '2008-1-3';</code></p>
<p>Now to add RSS feed to this action, first add the ‘RequestHandler’ component in the controller’s $components attribute.</p>
<p><code>var $components = array('RequestHandler');</code></p>
<p>And then add the following line in the app/config/routes.php</p>
<p><code>Router::parseExtensions();</code></p>
<p>By adding these two lines you are telling Cake to auto-detect the requested content type and respond accordingly. As an example, when a request arrives at www.example.com/posts, Cake will render the corresponding view file and serve the normal XHTML. But if a request arrives at www.example.com/posts.rss, Cake will detect that a RSS feed is requested.</p>
<p>When Cake finds out the requested content type is RSS, it does two things -<br />
1.	Automatically adds the RSSHelper to the controller<br />
2.	Renders the RSS feed using the view file –app/views/controller_name/rss/action_name.ctp</p>
<p>So, you need to create separate view files for RSS feeds. For the posts/index action, create index.ctp file inside app/views/posts/rss folder with the following codes.<br />
<code><br />
items($posts, 'transformRSS');<br />
function transformRSS($post) {<br />
		return array(<br />
			'title' =&gt; $post ['Post']['title'],<br />
			'link'  =&gt; array('action' =&gt; 'view', $post['Post']['id']),<br />
			'guid'  =&gt; array('action' =&gt; 'view', $post ['Post']['id']),<br />
			'description' =&gt; $post ['Post']['body'],<br />
			'author' =&gt; $post ['User']['name'],<br />
			'pubDate' =&gt; $post['Post']['modified']<br />
		);<br />
}<br />
?&gt;</code></p>
<p>The items() method can have two parameters.</p>
<p><code>$rss-&gt;items($data, 'callbackFunction');</code></p>
<p>The first one is an array of data that we want to put in our RSS feed. The second parameter is the name of the callback function that maps each element of the $data array to RSS feed elements. In other words, the callback function is executed for each element of the $data array. Inside the callback function, child elements of the item tag of the RSS feed is mapped against each element of the data array.<br />
Look closely at the above code to have a better understanding of how a callback function maps elements of the $data array to the elements of the RSS.<br />
P.S. The ‘link’ and the ‘guid’ elements take data in regular Cake URL parameter format. Cake automatically reformats the timestamp provided for the &#8220;pubDate&#8221; element into the RSS standard. The $title_for_layout set in the action will automatically become the RSS feed’s channel title.<br />
If you find your callback function is mostly the same in several different controllers, you can write down a custom helper class with the callback method and (re)use that method in the view file like the following -</p>
<p><code>echo $rss-&gt;items($posts, array($theHelper, 'callbackFunction'));</code></p>
<p>Sometime instead of using a single controller action for serving both (X)HTML and RSS, you may want to have a separate controller action for serving RSS feed. You can do that too using the RSSHelper!  Let’s assume, you want to serve RSS feed from the index() action of the FeedsController.</p>
<p>First, add the RSSHelper in the controller’s $helpers array-</p>
<p><code>var $helpers = array('rss');</code></p>
<p>Inside the index() action, define an array of associative arrays for item tags and their child tags, like the following. </p>
<p><code>$items = array(<br />
array('title' =&gt; 'title1', 'guid' =&gt; 'http://www.example.com/guid1', 'link' =&gt; 'http://www.example.com/link1', 'description' =&gt; 'description1'),<br />
array('title' =&gt; 'title2', 'guid' =&gt; 'http://www.example.com/guid2', 'link' =&gt; 'http://www.example.com/link2', 'description' =&gt; 'description2'),<br />
array('title' =&gt; 'title3', 'guid' =&gt; 'http://www.example.com/guid3', 'link' =&gt; 'http://www.example.com/link3', 'description' =&gt; 'description3')<br />
);<br />
</code></p>
<p>And then pass the array to the view.</p>
<p><code>$this-&gt;set('items', $items);</code></p>
<p>Define another associative array to denote immediate children of the channel tag and pass that to the view.</p>
<p><code>$channel = array ('title' =&gt; 'Channel Title', 'link' =&gt; 'http://www.example.com/', 'description' =&gt; 'Channel Description');<br />
$this-&gt;set('channel', $channel);<br />
</code></p>
<p>Change the layout of the view to rss,</p>
<p><code>$this-&gt;layout = 'rss/default';</code></p>
<p>Create the view file &#8211; views/feeds/index.ctp, for this action. The view file in fact, will contain only one single line.</p>
<p><code>items($items); ?&gt;</code></p>
<p>And now the index() action of the FeedsController is ready to serve RSS feeds.<br />
Sometime, you may like to have customized title, link or description for the channel tag while you are using one single action for serving both (X)HTML and RSS ( usually, they are auto-generated – like title is the same as the page_title set for that action, link is the same as the site address). In that case, you may do something like the following – </p>
<p><code>if ($this-&gt;RequestHandler-&gt;isRss()) {<br />
           $channel = array (<br />
                                            'title'             =&gt; 'Channel Title',<br />
                                            'link'             =&gt; 'http://www.example.com/',<br />
                                            'description'  =&gt; 'Channel Description'<br />
           );<br />
           $this-&gt;set('channel', $channel);<br />
}<br />
</code></p>
<p>Hope it helps!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/anupom.wordpress.com/53/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/anupom.wordpress.com/53/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupom.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupom.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupom.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupom.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupom.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupom.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupom.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupom.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupom.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupom.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=53&subd=anupom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://anupom.wordpress.com/2008/03/12/rss-in-cakephp-12/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/093e82f19edc6281344aa3b707c6e2b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">anupom</media:title>
		</media:content>
	</item>
		<item>
		<title>Ten Minus Two Ways to Skip Cake Defaults</title>
		<link>http://anupom.wordpress.com/2007/10/27/eight-ways-to-skip-cake-defaults/</link>
		<comments>http://anupom.wordpress.com/2007/10/27/eight-ways-to-skip-cake-defaults/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 20:30:02 +0000</pubDate>
		<dc:creator>anupom</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anupom.wordpress.com/2007/10/27/ten-ways-to-skip-cake-defaults-part-i/</guid>
		<description><![CDATA[&#8220;Convention over Configuration&#8221; &#8211; a smart, elegant and clever approach that has made CakePHP different from other PHP frameworks. When it works, its automagic mesmerizes our mind. Bonus, adhering a particular convention always increases the quality and maintainability of the code. 
But still there are times when we can not stick to the convention. There [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=49&subd=anupom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#8220;Convention over Configuration&#8221; &#8211; a smart, elegant and clever approach that has made CakePHP different from other PHP frameworks. When it works, its automagic mesmerizes our mind. Bonus, adhering a particular convention always increases the quality and maintainability of the code. </p>
<p>But still there are times when we can not stick to the convention. There are times when our minds want to fly higher; they don’t want to be caged by any rule! They want flexibility!</p>
<p>“Cake is too strict” / “Cake is not flexible at all” &#8211; I don’t know how may times I have heard complains like these about my beloved Cake. These are all rubbish; Cake is enough flexible to do almost anything you want. Here goes some ways to escape the convention.</p>
<p><em>Case #1. Database table names</em><br />
According to Cake Convention, table names should be English plural with underscores in between the words, like users, big_brothers etc. If we have a model class named Post then the related database table is posts. This is what Cake thinks by default, it understands it automatically; you don’t have to write it down explicitly.</p>
<p>Yes, it is too cool! But what if we want something else, we want to use artikel table to get related with the Post model. In some cases we may need it, especially when we are using a legacy table. It is too simple,</p>
<p><code>class Post extends AppModel<br />
{<br />
	var $useTable = 'artikel';<br />
}</code></p>
<p><em>Case #2. Database configuration</em><br />
We know by default Cake uses the ‘default’ configuration specified at /app/config/database.php. However, we may like to use a different database for only the Post model. Suppose, we have specified another database configuration named ‘anotherdb’ in the database.php and we want our Post model to use that configuration. That’s too as easy as drinking milk,</p>
<p><code>class Post extends AppModel<br />
{<br />
	var $useDbConfig = 'anotherdb';<br />
}</code></p>
<p><em>Case #3. Primary key</em><br />
By default, Cake thinks the primary_key of any table is id. Sometime it may not be the case. You may have some other name for the primary key. Too simple,</p>
<p><code>class Post extends AppModel<br />
{<br />
	var $primaryKey = 'tin_number';<br />
}</code></p>
<p><em>Case #4. Join table</em><br />
By convention, join table between books and categories should have the name books_categories. Suppose, in our case, the name of the join table is books2categories! It is also possible to fit in to the meticulous (!) framework CakePHP. Just change the value of the joinTable key to books2categories in $hasAndBelongsToMany array in respective Model, as an example in Book model,</p>
<p><code>var $hasAndBelongsToMany = array(<br />
        	'Category' =&gt;<br />
            		array('className'            =&gt; 'Category',<br />
                		          'joinTable'              =&gt; 'books2categories',<br />
				…..</code></p>
<p><em>Case #5. Using different model, more than one model or no model</em><br />
Assume, we want to use Book model from posts_controller.<br />
It&#8217;s plain and simple, just add/change the $uses variable in PostsController,</p>
<p><code>var $uses = array(‘Book’);</code></p>
<p>Let&#8217;s say, We are now getting more demanding, we want to use both Book model and Post model in PostsController, yeah right, just have to do the following,</p>
<p><code>var $uses = array(‘Post’ , ‘Book’);</code></p>
<p>You have surely guessed what should be done to use no model at all,</p>
<p><code>var $uses = array();</code><br />
 <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><em>Case #6. Foreign Key not in pattern tablename_id</em><br />
By convention, foreign keys should have names like tablename_id. So, if our posts hasMany comments, the comments table should have a field named post_id that holds the id of the related record of the posts table. Assume, for the sake of the example that we don&#8217;t have any id field in the posts table and the primary of the posts table is &#8217;slug&#8217;.</p>
<p>Suppose, we added a foreign key named &#8216;post_slug&#8217; in the comments table. We can define it as the foreign key in Cake like this,</p>
<p>In Post model,<br />
	<code>var $hasMany = array(<br />
		'Comment' =&gt; array(<br />
			'className'   =&gt; 'Comment',<br />
			'foreignKey'  =&gt; 'post_slug'<br />
		)<br />
	);</code></p>
<p>And in the Comment model,<br />
       <code>var $belongsTo = array(<br />
		'Post' =&gt; array(<br />
			'className'   =&gt; 'Post',<br />
			'foreignKey'  =&gt; 'post_slug'<br />
		)<br />
	);</code></p>
<p>And it will work like a charm!</p>
<p><em>Case #7. Modifying URL</em><br />
Huh! Does Cake URLs should always be like <code>http://yourhost.com/controller_name[/action_name][/parameters]</code> ?<br />
Not at all! If you find your URL structure boring and add some spice in it <code>app/config/routes.php</code> is your friend. Let&#8217;s say, we want to change <code>http://yourhost.com/users/login</code> to <code>http://yourhost.com/signin</code>. To do that open the <code>app/config/routes.php </code>and add the following line,</p>
<p><code>Router::connect('/signin', array('controller' =&gt; 'users', 'action' =&gt; 'login'));</code></p>
<p>Now you have a much prettier and shorter URL!</p>
<p><em>Case #8. Overriding layout</em><br />
Every page that we create is by default comes inside the layout &#8211; &#8220;<code>default.ctp</code>&#8220;. Now, for some particular controller actions we may like to have a different layout. Doing that is pretty straightforward,<br />
First create a separate layout inside <code>app/views/layouts</code> named <code>another.ctp</code><br />
Then inside the controller actions add the following line<br />
<code>$this-&gt;layout('another');</code><br />
And you are done! The view for that action will be rendered inside the layout &#8220;another.ctp&#8221;</p>
<p>Thank you so much !</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/anupom.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/anupom.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupom.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupom.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupom.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupom.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupom.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupom.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupom.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupom.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupom.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupom.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=49&subd=anupom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://anupom.wordpress.com/2007/10/27/eight-ways-to-skip-cake-defaults/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/093e82f19edc6281344aa3b707c6e2b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">anupom</media:title>
		</media:content>
	</item>
		<item>
		<title>Get Set Bake / Cake1.2 Console in Win Environment</title>
		<link>http://anupom.wordpress.com/2007/10/01/get-set-bake-cake12-console-in-win-environment/</link>
		<comments>http://anupom.wordpress.com/2007/10/01/get-set-bake-cake12-console-in-win-environment/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 18:57:42 +0000</pubDate>
		<dc:creator>anupom</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://anupom.wordpress.com/2007/10/01/get-set-bake-cake12-console-in-win-environment/</guid>
		<description><![CDATA[The first thing to do in most of the cake project is designing and creating the database and the next obvious step is usually Baking. Cake1.2 has a console script that handles the Baking stuff very smartly. You will find the console script cake.bat in CAKE_ROOT_DIRECTORY\cake\console\ directory.
If your PHP_ROOT_DIRECTORY is already added to your system [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=47&subd=anupom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The first thing to do in most of the cake project is designing and creating the database and the next obvious step is usually Baking. Cake1.2 has a console script that handles the Baking stuff very smartly. You will find the console script <em>cake.bat</em> in <em>CAKE_ROOT_DIRECTORY\cake\console\</em> directory.</p>
<p>If your <em>PHP_ROOT_DIRECTORY</em> is already added to your system path then you can run the script from the command prompt without any problem. Go to <em>CAKE_ROOT_DIRECTORY\cake\console</em> directory from command prompt and start baking your cake by entering the magic command <em>&#8216;cake bake&#8217;</em>. </p>
<p>If the <em>&#8216;cake bake&#8217;</em> command throws an error message like this -<br />
&#8220;<em>&#8216;php&#8217; is not recognized as an internal or external command, operable program or batch file</em>&#8220;, &#8211; it means the <em>PHP_ROOT_DIRECTORY</em> is not added to your system path. In that case, you have to add the <em>PHP_ROOT_DIRECTORY</em> to your system path first. Go to <em>CAKE_ROOT_DIRECTORY\cake\console</em> directory from the command prompt. If your <em>PHP_ROOT_DIRECTORY</em> is <em>C:\php</em> then enter the following command to set up the path,<br />
<em>set path=C:\php</em> (notice, there is no space before and after the &#8216;=&#8217;),<br />
Now the &#8216;cake bake&#8217; command should work fine.</p>
<p>If you did not configure the database settings in <em>CAKE_ROOT\app\config\database.php</em> yet then you will see something like the following after running the console script,<br />
<code><br />
Welcome to CakePHP v1.2.0.5427alpha Console<br />
---------------------------------------------------------------<br />
App : app<br />
Path: C:\www_root\one_point_two\app<br />
---------------------------------------------------------------<br />
Your database configuration was not found. Take a moment to create one.<br />
</code><code><br />
Database Configuration:<br />
Driver: (mysql/mysqli/mssql/sqlite/postgres/odbc/oracle/db2)<br />
[mysql] &gt;<br />
</code></p>
<p>The script will exit when the database configuration is done. Now it should again be executed to continue the baking process. Enter <em>cake bake</em> command again and you will be prompted with something like the following..</p>
<p><code>Welcome to CakePHP v1.2.0.5427alpha Console<br />
---------------------------------------------------------------<br />
App : app<br />
Path: C:\www_root\one_point_two\app<br />
---------------------------------------------------------------<br />
Interactive Bake Shell<br />
---------------------------------------------------------------<br />
[M]odel<br />
[V]iew<br />
[C]ontroller<br />
[Q]uit<br />
What would you like to Bake? (M/V/C/Q)</p>
<p></code></p>
<p>Follow the recipe, add ingredients, mix them as you want and after some few seconds you will get your first hot cake right out of the oven.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/anupom.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/anupom.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupom.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupom.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupom.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupom.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupom.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupom.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupom.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupom.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupom.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupom.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=47&subd=anupom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://anupom.wordpress.com/2007/10/01/get-set-bake-cake12-console-in-win-environment/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/093e82f19edc6281344aa3b707c6e2b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">anupom</media:title>
		</media:content>
	</item>
		<item>
		<title>Call Controller Functions or Access Controller Variables from Views</title>
		<link>http://anupom.wordpress.com/2007/01/08/call-controller-functions-or-access-controller-variables-from-views/</link>
		<comments>http://anupom.wordpress.com/2007/01/08/call-controller-functions-or-access-controller-variables-from-views/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 11:27:53 +0000</pubDate>
		<dc:creator>anupom</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://anupom.wordpress.com/2007/01/08/call-controller-functions-or-access-controller-variables-from-views/</guid>
		<description><![CDATA[By the convention of the MVC design pattern, I think it may not be recommended, but it is sometime very useful for the sake of ease &#38; simplicity.
If you have a controller variable var1 &#38; a controller function func1(), you can call them directly from your views like the following:
&#60;?php
$this-&#62;controller-&#62;func1();
echo $this-&#62;controller-&#62;var1;
?&#62;
Again, (over) referencing the controller [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=40&subd=anupom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>By the convention of the MVC design pattern, I think it may not be recommended, but it is sometime very useful for the sake of ease &amp; simplicity.</p>
<p>If you have a controller variable var1 &amp; a controller function func1(), you can call them directly from your views like the following:</p>
<p><code>&lt;?php<br />
$this-&gt;controller-&gt;func1();<br />
echo $this-&gt;controller-&gt;var1;<br />
?&gt;</code></p>
<p>Again, (over) referencing the controller from the view is not recommended. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/anupom.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/anupom.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupom.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupom.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupom.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupom.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupom.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupom.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupom.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupom.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupom.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupom.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=40&subd=anupom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://anupom.wordpress.com/2007/01/08/call-controller-functions-or-access-controller-variables-from-views/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/093e82f19edc6281344aa3b707c6e2b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">anupom</media:title>
		</media:content>
	</item>
		<item>
		<title>Get Controller, Action, URL information from Views/Elements</title>
		<link>http://anupom.wordpress.com/2007/01/08/get-controller-action-url-information-from-viewselements/</link>
		<comments>http://anupom.wordpress.com/2007/01/08/get-controller-action-url-information-from-viewselements/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 11:26:56 +0000</pubDate>
		<dc:creator>anupom</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://anupom.wordpress.com/2007/01/08/get-controller-action-url-information-from-viewselements/</guid>
		<description><![CDATA[It is sometime very useful to know the name of the controller/action that is calling the view/elements.
Suppose you want to create a menubar/navigation element, where you want to highlight the menuitem which is now active. Now, it will be easier for you to highlight the menuitem accordingly if you can get the url or controller/action [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=39&subd=anupom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It is sometime very useful to know the name of the controller/action that is calling the view/elements.</p>
<p>Suppose you want to create a menubar/navigation element, where you want to highlight the menuitem which is now active. Now, it will be easier for you to highlight the menuitem accordingly if you can get the url or controller/action name from the element&#8217;s code.</p>
<p>You can get this easily, every view or element gets a parameter by default in cakePHP called $params. The $params is an associative array that looks like-</p>
<p><code>Array (<br />
[controller] =&gt; controller_name<br />
[action] =&gt; action_name<br />
[url] =&gt; Array         (             [url] =&gt; cake_url )<br />
)</code></p>
<p>So, by calling <code>$params['url']['url']</code> from your views/elements you will get the current url. Thanks.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/anupom.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/anupom.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupom.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupom.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupom.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupom.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupom.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupom.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupom.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupom.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupom.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupom.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=39&subd=anupom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://anupom.wordpress.com/2007/01/08/get-controller-action-url-information-from-viewselements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/093e82f19edc6281344aa3b707c6e2b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">anupom</media:title>
		</media:content>
	</item>
		<item>
		<title>Configuring Dreamweaver 8 for Editing .thtml</title>
		<link>http://anupom.wordpress.com/2007/01/08/configuring-dreamwaver-8-for-editing-thtml/</link>
		<comments>http://anupom.wordpress.com/2007/01/08/configuring-dreamwaver-8-for-editing-thtml/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 11:26:10 +0000</pubDate>
		<dc:creator>anupom</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://anupom.wordpress.com/2007/01/08/configuring-dreamwaver-8-for-editing-thtml/</guid>
		<description><![CDATA[To configure Dreamweaver 8 for treating a .thtml file as a php file, open dreamweaver_installation_folder\Configuration\DocumentTypes\MMDocumentTypes.xml  with any text editor and find out the line containing winfileextension="php,php3,php4,php5".
Now add &#8216;,thtml&#8217; at the end of this string like  this: winfileextension="php,php3,php4,php5,thtml".
That&#8217;s all, Dreamweaver will now code-color .thtml files as it does for .php files. Thank you!
  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=38&subd=anupom&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>To configure Dreamweaver 8 for treating a .thtml file as a php file, open dreamweaver_installation_folder\Configuration\DocumentTypes\MMDocumentTypes.xml  with any text editor and find out the line containing <code>winfileextension="php,php3,php4,php5"</code>.</p>
<p>Now add &#8216;,thtml&#8217; at the end of this string like  this: <code>winfileextension="php,php3,php4,php5,thtml"</code>.</p>
<p>That&#8217;s all, Dreamweaver will now code-color .thtml files as it does for .php files. Thank you!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/anupom.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/anupom.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupom.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupom.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupom.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupom.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupom.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupom.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupom.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupom.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupom.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupom.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupom.wordpress.com&blog=295932&post=38&subd=anupom&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://anupom.wordpress.com/2007/01/08/configuring-dreamwaver-8-for-editing-thtml/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/093e82f19edc6281344aa3b707c6e2b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">anupom</media:title>
		</media:content>
	</item>
	</channel>
</rss>