<?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>Promet CakePHP Source &#187; CakePHP 1.1</title>
	<atom:link href="http://cakephp.prometsupport.com/category/cakephp-11/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakephp.prometsupport.com</link>
	<description></description>
	<lastBuildDate>Mon, 23 Feb 2009 08:03:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>INI Based Permission Component</title>
		<link>http://cakephp.prometsupport.com/2009/ini-based-permission-component/</link>
		<comments>http://cakephp.prometsupport.com/2009/ini-based-permission-component/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 13:37:42 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[Behaviors]]></category>
		<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[cakePHP websites]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/?p=142</guid>
		<description><![CDATA[Yet another permission component was created this week but this time, it&#8217;s simplier and written in a text file. In one of our project, one of the follow-up requirement was to allow users of certain groups upgrade into a better status. The project was already in production and I was using ACL with Auth component [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another permission component was created this week but this time, it&#8217;s simplier and written in a text file. In one of our project, one of the follow-up requirement was to allow users of certain groups upgrade into a better status. The project was already in production and I was using ACL with Auth component to do my authentication. Unfortunately, this is one of <a href="http://www.mail-archive.com/cake-php@googlegroups.com/msg57645.html">ACLs weakness</a>. </p>
<blockquote><p>Changing a users group does not change the ARO parent (effectively making it useless/impossible to change groups). I tried fixing this home-brew style, but since there&#8217;s no setParent in 1.2&#8242;s db_acl, it&#8217;s far harder than it should be.</p>
</blockquote>
<p>That was reported back in 2007 and there was still no solution found in the net. It is also not an option for me to go through the above suggestion in fixing the problem so the the other solution is to find another one or create one. I chose the latter.</p>
<p><strong>Why create a new one?</strong></p>
<p>The other solutions that I found still needs some configuration in the controllers. Since I already have a ton of files, I don&#8217;t want to go through all of them to add a line or two. I need ACLs way of doing it all in the background. Also, I am already using Auth component and I want to keep it.</p>
<p><strong>Why did I choose a text file over a database?</strong></p>
<p>My intention is to make the application faster since load time is really getting slower. Since the application isn&#8217;t that big, I only have less than 200 lines for the permissions, so a database is just overkill. Even if I use a database, I might cache it anyway so it saves me extra query.</p>
<p><strong>The component</strong></p>
<p>So Permission Component was created. Below is the instruction on how to install it.</p>
<ol>
<li><a href='http://cakephp.prometsupport.com/wp-content/uploads/2009/01/permissionphp.txt'>Download this component</a> and copy to your components folder. </li>
<li>Create cake_dir/app/config/permissions.ini</li>
</ol>
<p>The content for permissions.ini is as follows</p>
<p><code lang="ini[lines]"><br />
[ControllerName]<br />
actionName = group_id,group_id<br />
 <br />
[PluginName.ControllerName]<br />
actionName = group_id,group_id<br />
</code></p>
<p>The <em>ControllerName</em> should be the controller name itself (in camel-case format).</p>
<p>The <em>actionName</em> is also the action name itself (in camel-case format).</p>
<p>The <em>PluginName</em> is the plugin name itself (in camel-case format).</p>
<p>The <em>group_id</em> is the one written in your Auth component. Your Auth component should have a group_id value because this is what our Permission component will look for. It could be a number or set of characters.</p>
<p>Example:</p>
<p><code lang="ini[lines]"><br />
; Group ID 1 = Admin<br />
; Group ID 2 = Member<br />
[Accounts]<br />
index =<br />
add = 1<br />
edit = 1,2<br />
delete = 1,2<br />
 <br />
[ShoppingCart.Orders]<br />
index =<br />
report = 1<br />
</code></p>
<p>Assigning no group id in an actionName will simply ignore it.</p>
<p><strong>Reminder</strong></p>
<p>Use at your own risk. If you found a bug, please post them at the comment form.</p>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2009/ini-based-permission-component/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using TinyMCE with CakePHP</title>
		<link>http://cakephp.prometsupport.com/2008/using-tinyce-with-cakephp/</link>
		<comments>http://cakephp.prometsupport.com/2008/using-tinyce-with-cakephp/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 15:51:40 +0000</pubDate>
		<dc:creator>cyrose</dc:creator>
				<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/01/31/17/</guid>
		<description><![CDATA[It’s finally my deadline. Oh well, I am not really a blogger so I just hope you’ll stick with my article. Please bear with my “work of art”. Duh?!? Ok, let’s get this started. As the title says, my article is all about TinyMCE + Cakephp. This may not be too challenging or may appear [...]]]></description>
			<content:encoded><![CDATA[<p>It’s finally my deadline. Oh well, I am not really a blogger so I just hope you’ll stick with my article. Please bear with my “work of art”. Duh?!?</p>
<p>Ok, let’s get this started. As the title says, my article is all about TinyMCE + Cakephp. This may not be too challenging or may appear newly baked for others but for me, it’s something worth writing for. There’s just a few blocks of information that I need to discuss and everything we’ll be done in a short while.</p>
<p>TinyMCE is a WYSIWYG editor by Moxiecode which is <a href="http://tinymce.moxiecode.com">downloadable for free</a>. It has been integrated with some of the fast-rising CMS in the OS community nowadays. Such would be joomla and drupal. Here, integrating is so easy, so just follow these steps and good luck:</p>
<ol>
<li><a href="http://tinymce.moxiecode.com/download.php">Download tinyMCE</a>.</li>
<li>Once downloaded, unpack TinyMCE, and copy just the <i>tinymce/jscripts/tiny_mce</i> folder in <i>/webroot/js</i>.</li>
<li>Then follows the configuration. To make this thing work on cakephp, simple do these:
<ol type="a">
<li>First, add the code below to the layout(s) that will be used on the page(s) that will have the editor.<br />
<code lang="javascript"><br />
<script type="text/javascript"> 
  tinyMCE.init({ 
    theme : "simple",
    mode : "textareas",
    convert_urls : false
  }); 
</script><br />
</code>
  </li>
<li>Add the javascript helper to your $helpers array in your controller(s)</li>
<li>Then, for each page that you would want the TinyMCE editor to show, just add to the top of the view file this code below:<br />
<code lang="javascript"><br />
<script type="text/javascript"> 
  tinyMCE.init({ 
    theme : "simple",
    mode : "textareas",
    convert_urls : false
  }); 
</script><br />
</code>
  </li>
</ol>
</li>
</ol>
<p>Source: <a href="http://bakery.cakephp.org/articles/view/using-tinymce-with-cakephp">Bakery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/using-tinyce-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Binding your Models the Easy Way</title>
		<link>http://cakephp.prometsupport.com/2008/binding-ur-models-d-easy-way/</link>
		<comments>http://cakephp.prometsupport.com/2008/binding-ur-models-d-easy-way/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 02:39:44 +0000</pubDate>
		<dc:creator>carol</dc:creator>
				<category><![CDATA[Associations]]></category>
		<category><![CDATA[CakePHP 1.1]]></category>
		<category><![CDATA[Model]]></category>
		<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[bindModel]]></category>
		<category><![CDATA[unbindModel]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/01/15/my-piece-of-cakefinally/</guid>
		<description><![CDATA[Finally, I&#8217;ve posted my first cakephp blog which is already a week late. So late that I really had a hard time picking a nice topic to make it worth the wait. I don&#8217;t know if this one is but I hope it&#8217;ll be helpful especially to those who are new to cake. Ive been [...]]]></description>
			<content:encoded><![CDATA[<p>    Finally, I&#8217;ve posted my first cakephp blog which is already a week late. So late that I really had a hard time picking a  nice topic to make it worth the wait.  I don&#8217;t know if this one is but I hope it&#8217;ll be helpful especially to those who are new to cake.  Ive been working on <a href="http://isupportthismessage.com">IsupportThisMessage.com</a> for almost a year and still supporting it until now since they&#8217;re planning to add more functionalities to the system. This is where I learned the basics of cake.The <a href="http://manual.cakephp.org">manual</a> is quite simple and I&#8217;ve read it over and over. But when I thought I already know a lot and started coding,  I realized, I don&#8217;t even know a bit. So really, there&#8217;s no better way of learning than actually applying it. And for almost a year, I&#8217;ve learned a lot but I must admit, I still have a lot to learn.</p>
<p>One nice thing I like about cake is the use of <a href="http://www.enode.com/x/markup/tutorial/mvc.html">MVC pattern</a> which makes my codes more organized. And I like how the querying is done which is made more simple because you wouldn&#8217;t need to declare associated tables within your query if you have already specified the associations within your model.  Fantastic!  One of the most powerful features of CakePHP is the relational       mapping provided by the model.  At first, I didn&#8217;t want to touch anything in the models coz I was confused about associations. Besides I was scared I might break the code. But when I finally understood how, I declared the necessary associations within my models most especially &#8220;messages&#8221;, coz in isupport this is often being used and it has a lot of associated tables in it. But sometimes, when you query, your association settings in the model file are giving you too much       (or not enough) information. What I mean to say is, sometimes you wouldn&#8217;t need some of the associated tables in your query result. So you have to think of a way how to minimize the result, and that is where <strong>unbindModel</strong> &amp; <strong>bindModel</strong>  model functions are used which allow you to change your association settings on the fly. But as quoted from the <a href="http://bakery.cakephp.org/articles/view/keeping-bindmodel-and-unbindmodel-out-of-your-controllers">bakery section of cakephp.org by TommyO</a>,</p>
<blockquote><p>Changing the requirements of a bind done in this way means going through your controllers and changing the bindModel call, often in multiple places. Using unbindModel in a controller also means every time a new association is added you may need to go back into your controllers and unbind the new associations in order to optimize your code.</p></blockquote>
<p>Silly, but true. Thanks to TommyO, he created a method to simplify this using the approach:</p>
<blockquote><p>binding to other Models only when needed or unbinding existing relations to minimize the size of your result set.</p></blockquote>
<p>But just an overview, you would just need to add a function within your appmodel. Then in your model class, just define your associations within an array called $assoc. You will see an example from the link. So easy huh?</p>
<p>So in your controller:</p>
<p><code><span style="color: #000000"> <span style="color: #0000bb">&lt;?php<br />
MessageController </span><span style="color: #007700">extends </span><span style="color: #0000bb">AppController </span><span style="color: #007700">{<br />
function index(</span><span style="color: #0000bb">$id</span><span style="color: #007700">) {<br />
</span><span style="color: #ff8000">// establish necessary associations<br />
</span><span style="color: #0000bb">$this</span><span style="color: #007700">-&gt;Message</span><span style="color: #0000bb"></span><span style="color: #007700">-&gt;</span><span style="color: #0000bb">expects</span><span style="color: #007700">(array(</span><span style="color: #dd0000">'Comments'</span><span style="color: #007700">, </span><span style="color: #dd0000">'User'</span><span style="color: #007700">));<br />
</span><span style="color: #0000bb"></span><span style="color: #007700"></span><span style="color: #0000bb">$results </span><span style="color: #007700">= </span><span style="color: #0000bb">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000bb">Message</span><span style="color: #007700">-&gt;</span><span style="color: #0000bb">findAll</span><span style="color: #007700">(</span><span style="color: #0000bb"></span><span style="color: #007700"></span><span style="color: #0000bb"></span><span style="color: #007700">);<br />
}<br />
}<br />
</span><span style="color: #0000bb">?&gt;</span>  </span> </code></p>
<p>Now you have it. But that&#8217;s not all. Ive read <a href="http://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel-on-model-side">another post in the bakery related to TommyO&#8217;s method</a> for model associations. In TommyO&#8217;s approach, there&#8217;s a slight difference on the way you define your model association and the models get loaded *when* you call the <i>expects()</i> function. According to Mariano, the author of the post, he said he&#8217;s not a fan of changing how things are done in cakephp, neither do I. His approach is to use the Cakephp way of defining associations in the models and then specify which relations he&#8217;s interested in getting back when querying a model. This way, models behave the way models are supposed to. The main idea here is that you define your associations in the model the cakephp way. Then in your controller, if you want the standard result cakephp brings then you don&#8217;t need to call <i>expects()</i> (With TommyO&#8217;s approach, you will need to call <i>expects()</i>  with all the necessary values). Use <i>expects()</i>, only when you want to limit the result of your query. And if you want to unbindAll just call <i>expects()</i> with no parameters. You will need to add three functions in your appmodel which you will find <a href="http://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel-on-model-side">here</a>. There are additional topics included here like &#8220;<em>making multiple expects in one call</em>&#8220;. And if I&#8217;m a little confusing in explaining, I think you can understand it better when you visit the links. hehehehe.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/binding-ur-models-d-easy-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
