<?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; Helpers</title>
	<atom:link href="http://cakephp.prometsupport.com/category/views/helpers/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>jQuery star rating problem with brackets []</title>
		<link>http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/</link>
		<comments>http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 10:54:23 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[bug fixes]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[star rating]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/</guid>
		<description><![CDATA[If you used the star rating plugin of jQuery in cakePHP, you might experienced that the hover effects are not working properly. This is because one of the class name used to identify the buttons uses the radio button name. This will be a problem in cakephp because we use brackets in names. In order [...]]]></description>
			<content:encoded><![CDATA[<p>If you used the <a href="http://plugins.jquery.com/project/MultipleFriendlyStarRating">star rating plugin of jQuery</a> in cakePHP, you might experienced that the hover effects are not working properly. This is because one of the class name used to identify the buttons uses the radio button name. This will be a problem in cakephp because we use brackets in names.</p>
<p><code lang="html"></p>
<input type="radio" name="data[Model][field]" class="star" />
</code></p>
<p>In order to fix that, we need to remove them. Here is quick fix. Open file <code>jquery.rating.js</code>:</p>
<p>from (line 97):<br />
<code lang="javascript"><br />
// grouping:<br />
  var n = this.name;<br />
</code></p>
<p>to:<br />
<code lang="javascript"><br />
// grouping:<br />
  var real_name = this.name;<br />
  var n = real_name.replace(/[^A-Za-z0-9_\-]/g, '-'); // remove unwanted characters<br />
</code></p>
<p>from (line 108):<br />
<code lang="javascript"><br />
$.rating.groups[n].valueElem = $('<br />
<input type="hidden" name="' + n + '" value=""' + (settings.readOnly ? ' disabled="disabled"' : '') + '>');<br />
</code></p>
<p>to:<br />
<code lang="javascript"><br />
$.rating.groups[n].valueElem = $('<br />
<input type="hidden" name="' + real_name + '" value=""' + (settings.readOnly ? ' disabled="disabled"' : '') + '>');</code></p>
<p>I have <a href="http://plugins.jquery.com/node/3365">reported this in the bugtracker</a> and I hope it will be included in the next release.</p>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/jquery-star-rating-problem-with-brackets/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Making Clickable Images on CakePHP</title>
		<link>http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/</link>
		<comments>http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 08:14:43 +0000</pubDate>
		<dc:creator>cyrose</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Helpers]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/</guid>
		<description><![CDATA[Hello again, Yesterday, i stumbled upon this problem on how am i suppose to create an image with a link on it. I needed to know it because of my goal. I wanted to use images as my buttons to navigate the admin pages. So without further ado, here&#8217;s how: 1. We will use HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Hello again,</p>
<p>Yesterday, i stumbled upon this problem on how am i suppose to create an image with a link on it. I needed to know it because of my goal. I wanted to use images as my buttons to navigate the admin pages. So without further ado, here&#8217;s how:</p>
<p>1. We will use HTML Helpers Image and Link, and we shall combine this 2.</p>
<p>2. For Image,</p>
<p>Syntax:</p>
<p>$html-&gt;image(string <em>$path</em>, array <em>$htmlAttributes</em>, boolean <em>$return = false);</em></p>
<p>Example:</p>
<p>$html-&gt;image(&#8216;/img/images/cancel.png&#8217;, array(&#8216;class&#8217; =&gt; &#8216;save_button&#8217;));</p>
<p>3. For Link,</p>
<p>Syntax:</p>
<p>$html-&gt;link(string <em>$title, </em>string <em>$url, </em>array <em>$htmlAttributes, </em>string <em>$confirmMessage = false, </em>boolean <em>$escapeTitle = true, </em>boolean <em>$return = false</em>);</p>
<p>Example:</p>
<p>$html-&gt;link(&#8216;SAVE&#8217;, &#8216;/registers&#8217;, array(), false, false, false);</p>
<p>4. So to make an image clickable,</p>
<p>&lt;?php echo $html-&gt;link($html-&gt;image(&#8216;/img/images/cancel.png&#8217;,array(&#8216;class&#8217; =&gt; &#8216;save_button&#8217;)), &#8216;/registers&#8217;, array(), false, false, false); ?&gt;</p>
<p>That&#8217;s it. I hope this will help you in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/making-clickable-images-on-cakephp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Convenient $html-&gt;link()</title>
		<link>http://cakephp.prometsupport.com/2008/convenient-html-link/</link>
		<comments>http://cakephp.prometsupport.com/2008/convenient-html-link/#comments</comments>
		<pubDate>Wed, 28 May 2008 11:41:48 +0000</pubDate>
		<dc:creator>rachel</dc:creator>
				<category><![CDATA[CakePHP 1.2]]></category>
		<category><![CDATA[Helpers]]></category>
		<category><![CDATA[html helper]]></category>
		<category><![CDATA[route]]></category>

		<guid isPermaLink="false">http://cakephp.prometsupport.com/2008/05/28/convenient-html-link/</guid>
		<description><![CDATA[I made this quick helper that extends Html Helper. While creating my very first plugin for cakephp 1.2, I decided to use Route so that I can save some space and time typing long controller names. Here is the sample code in my views: echo $html->link( 'Link Test', array( 'controller' => 'long_controller_name', 'actions' => 'index', [...]]]></description>
			<content:encoded><![CDATA[<p>I made this quick helper that extends Html Helper. While creating my very first plugin for cakephp 1.2, I decided to use Route so that I can save some space and time typing long controller names. Here is the sample code in my views:</p>
<p><code lang="php"><br />
echo $html->link( 'Link Test',<br />
                  array(<br />
                    'controller' => 'long_controller_name',<br />
                    'actions' => 'index',<br />
                    'plugin' => 'long_plugin_name'<br />
                  )<br />
                );</code></p>
<p>I am a lazy typist and so I wanted to be able to use shortcut names for the array keys such as the following:</p>
<pre>
c = controller
a = action
p = plugin

OR use numbers

0 = controller
1 = action
2 = plugin
</pre>
<p>I couldn&#8217;t find in the <a href="http://bakery.cakephp.org">bakery</a> any solution so I decided to create my own Html helper. Here is how you can install it:</p>
<p>First, add <a href='http://cakephp.prometsupport.com/wp-content/uploads/2008/05/xhtmlphphelper.txt' title='XHTML Helper'>this file</a> to your helpers folder located in<br />
<code>/cakedir/app/views/helpers/</code><br />
<a href='http://cakephp.prometsupport.com/wp-content/uploads/2008/05/xhtmlphphelper.txt' title='XHTML Helper'>Download XHTML Helper</a></p>
<p>Then, in your controller file, include the <strong>Xhtml</strong> to your helpers list. Example</p>
<p><code lang="php"><br />
class MyController extends AppController {<br />
  ...<br />
  var $helpers = array( 'Xhtml' );<br />
  ...<br />
}<br />
</code></p>
<p>That&#8217;s it. You can use it by doing the following:</p>
<p><code lang="php"><br />
echo $xhtml->link( 'Link Test',<br />
                    array(<br />
                        'c' => 'long_controller_name',<br />
                        'a' => 'index',<br />
                        'p' => 'long_plugin_name'<br />
                    )<br />
                 );</code></p>
<p>OR</p>
<p><code lang="php"><br />
echo $xhtml->link( 'Link Test',<br />
                    array( 'long_controller_name',<br />
	                       'index',<br />
	                       'long_plugin_name'<br />
	                )<br />
                 );</code></p>
<p>Take note of using <strong>xhtml</strong> instead of <strong>html</strong>. I hope I don&#8217;t mislead anyone for using the name XHTML <img src='http://cakephp.prometsupport.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> . I just want an extended HTML helper.</p>
<div class="notice">
<strong>[Update]:</strong> update code <a href="/2008/07/11/tip-use-cakephp-routeurl-for-your-urls/">here</a>
</div>
]]></content:encoded>
			<wfw:commentRss>http://cakephp.prometsupport.com/2008/convenient-html-link/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
