<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: CakePHP: PagesController with Admin Routing</title>
	<atom:link href="http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/</link>
	<description>fun and geekery</description>
	<lastBuildDate>Sat, 04 Feb 2012 14:59:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Emanuele</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-26522</link>
		<dc:creator>Emanuele</dc:creator>
		<pubDate>Sat, 04 Feb 2012 14:59:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-26522</guid>
		<description>For cakephp 2.0 I adapted this article:

http://nuts-and-bolts-of-cakephp.com/2011/03/15/dealing-with-static-pages-v2-or-3/

for the admin static pages, in this way:

 $staticAdminPages = array(
          &#039;tools&#039;
  );
  
  $staticAdminList = implode(&#039;&#124;&#039;, $staticAdminPages);
  
  Router::connect(&#039;/admin/:static&#039;, array(
          &#039;plugin&#039; =&gt; false,
          &#039;controller&#039; =&gt; &#039;pages&#039;,
          &#039;action&#039; =&gt; &#039;display&#039;, &#039;admin&#039; =&gt; true), array(
                  &#039;static&#039; =&gt; $staticAdminList,
                  &#039;pass&#039; =&gt; array(&#039;static&#039;)
                  )
          );

Obviously I wrote the admin_display function but I left these lines unchanged:

if (!empty($path[0])) {
   $page = $path[0];
}

Now I am able to connect to this url: 
http://server/site/admin/tools

Enjoy it!</description>
		<content:encoded><![CDATA[<p>For cakephp 2.0 I adapted this article:</p>
<p><a href="http://nuts-and-bolts-of-cakephp.com/2011/03/15/dealing-with-static-pages-v2-or-3/" rel="nofollow">http://nuts-and-bolts-of-cakephp.com/2011/03/15/dealing-with-static-pages-v2-or-3/</a></p>
<p>for the admin static pages, in this way:</p>
<p> $staticAdminPages = array(<br />
          &#8216;tools&#8217;<br />
  );</p>
<p>  $staticAdminList = implode(&#8216;|&#8217;, $staticAdminPages);</p>
<p>  Router::connect(&#8216;/admin/:static&#8217;, array(<br />
          &#8216;plugin&#8217; =&gt; false,<br />
          &#8216;controller&#8217; =&gt; &#8216;pages&#8217;,<br />
          &#8216;action&#8217; =&gt; &#8216;display&#8217;, &#8216;admin&#8217; =&gt; true), array(<br />
                  &#8216;static&#8217; =&gt; $staticAdminList,<br />
                  &#8216;pass&#8217; =&gt; array(&#8216;static&#8217;)<br />
                  )<br />
          );</p>
<p>Obviously I wrote the admin_display function but I left these lines unchanged:</p>
<p>if (!empty($path[0])) {<br />
   $page = $path[0];<br />
}</p>
<p>Now I am able to connect to this url:<br />
<a href="http://server/site/admin/tools" rel="nofollow">http://server/site/admin/tools</a></p>
<p>Enjoy it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Radek</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-14176</link>
		<dc:creator>Radek</dc:creator>
		<pubDate>Wed, 08 Sep 2010 23:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-14176</guid>
		<description>At first: GREAT post - I was looking something like this :) Thank You :)!!!

I did like You described, but it doesn&#039;t work for me. When I try to get access to foo/admin it asks me to log in - that&#039;s ok. But when I give correct login and passord it still gives me information that I&#039;m not authorised user, and shows me login screen again. But then I want to show foo/admin/users and type this address in web browser - page is shown correctly. No idea what can cause this behaviour.

Anny suggestions ?

Thanks,
Radek</description>
		<content:encoded><![CDATA[<p>At first: GREAT post &#8211; I was looking something like this <img src='http://www.actionshrimp.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Thank You <img src='http://www.actionshrimp.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> !!!</p>
<p>I did like You described, but it doesn&#8217;t work for me. When I try to get access to foo/admin it asks me to log in &#8211; that&#8217;s ok. But when I give correct login and passord it still gives me information that I&#8217;m not authorised user, and shows me login screen again. But then I want to show foo/admin/users and type this address in web browser &#8211; page is shown correctly. No idea what can cause this behaviour.</p>
<p>Anny suggestions ?</p>
<p>Thanks,<br />
Radek</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: weewew</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-12014</link>
		<dc:creator>weewew</dc:creator>
		<pubDate>Mon, 05 Jul 2010 07:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-12014</guid>
		<description>weweewewewew wewew wew ewew</description>
		<content:encoded><![CDATA[<p>weweewewewew wewew wew ewew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-11546</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Wed, 09 Jun 2010 11:57:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-11546</guid>
		<description>No idea why the class code didnt show, i&#039;ll try again without the php tags :)

&lt;code&gt;
require_once &#039;../../cake/libs/controller/pages_controller.php&#039;;

class AdmPagesController extends PagesController {
	var $name = &#039;AdmPages&#039;;

	public function admin_display(){
		//		parent::display(func_get_args());
		$vArgs = func_get_args();
		call_user_func_array(array(&#039;parent&#039;, &#039;display&#039;), $vArgs);
	}
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>No idea why the class code didnt show, i&#8217;ll try again without the php tags <img src='http://www.actionshrimp.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code><br />
require_once '../../cake/libs/controller/pages_controller.php';</p>
<p>class AdmPagesController extends PagesController {<br />
	var $name = 'AdmPages';</p>
<p>	public function admin_display(){<br />
		//		parent::display(func_get_args());<br />
		$vArgs = func_get_args();<br />
		call_user_func_array(array('parent', 'display'), $vArgs);<br />
	}<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-11545</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Wed, 09 Jun 2010 11:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-11545</guid>
		<description>Hi,
In an ideal scenario, you would not override the PagesController, or repeat the code by copying and pasting it. I solved this problem by adding this to routes.php:

&lt;code&gt;
Router::connect(&#039;/admin/adm_pages/*&#039;, array(&#039;controller&#039; =&gt; &#039;adm_pages&#039;, &#039;action&#039; =&gt; &#039;display&#039;, &#039;admin&#039; =&gt; 1));
&lt;/code&gt;

Then i created this class, adm_pages_controller.php:

&lt;code&gt;

&lt;/code&gt;

and then added my view to app/views/adm_pages/help.ctp.

This way, if you need to update your cake version, as long as the file structure and display method prototype stays the same, it will work :-)</description>
		<content:encoded><![CDATA[<p>Hi,<br />
In an ideal scenario, you would not override the PagesController, or repeat the code by copying and pasting it. I solved this problem by adding this to routes.php:</p>
<p><code><br />
Router::connect('/admin/adm_pages/*', array('controller' =&gt; 'adm_pages', 'action' =&gt; 'display', 'admin' =&gt; 1));<br />
</code></p>
<p>Then i created this class, adm_pages_controller.php:</p>
<p><code></p>
<p></code></p>
<p>and then added my view to app/views/adm_pages/help.ctp.</p>
<p>This way, if you need to update your cake version, as long as the file structure and display method prototype stays the same, it will work <img src='http://www.actionshrimp.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jack</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-11411</link>
		<dc:creator>Jack</dc:creator>
		<pubDate>Wed, 02 Jun 2010 08:51:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-11411</guid>
		<description>Hi -- I know this is completely unrelated to your post here, but your \LaTeX renderer on your &quot;PhysiWiki&quot; appears to have gone down. I&#039;m a current third year about to sit the B1, B2, and B3 papers and I&#039;ve found your site incredibly useful for them -- please could you fix it!

A thank you from St. Hugh&#039;s!</description>
		<content:encoded><![CDATA[<p>Hi &#8212; I know this is completely unrelated to your post here, but your \LaTeX renderer on your &#8220;PhysiWiki&#8221; appears to have gone down. I&#8217;m a current third year about to sit the B1, B2, and B3 papers and I&#8217;ve found your site incredibly useful for them &#8212; please could you fix it!</p>
<p>A thank you from St. Hugh&#8217;s!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dddd</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-11212</link>
		<dc:creator>dddd</dc:creator>
		<pubDate>Sun, 16 May 2010 09:43:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-11212</guid>
		<description>with cake 1.3 there is no more routing.admin
http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3

you have to change the control in the beforeFilter function

        $routing_prefixes = Configure::read(&#039;Routing.prefixes&#039;);
        if(in_array(&quot;admin&quot;, $routing_prefixes)){
            $admin =&#039;admin&#039;;
        }</description>
		<content:encoded><![CDATA[<p>with cake 1.3 there is no more routing.admin<br />
<a href="http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3" rel="nofollow">http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3</a></p>
<p>you have to change the control in the beforeFilter function</p>
<p>        $routing_prefixes = Configure::read(&#8216;Routing.prefixes&#8217;);<br />
        if(in_array(&#8220;admin&#8221;, $routing_prefixes)){<br />
            $admin =&#8217;admin&#8217;;<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benny L.E.P</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-10802</link>
		<dc:creator>Benny L.E.P</dc:creator>
		<pubDate>Mon, 19 Apr 2010 17:17:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-10802</guid>
		<description>Thank you you saved my live with this code, thank you very much and god bless you for your kindness :)</description>
		<content:encoded><![CDATA[<p>Thank you you saved my live with this code, thank you very much and god bless you for your kindness <img src='http://www.actionshrimp.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-6145</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 18 May 2009 06:44:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-6145</guid>
		<description>Do you get any errors or anything? And did you have the beforeFilter in the AppController class given right at the start?</description>
		<content:encoded><![CDATA[<p>Do you get any errors or anything? And did you have the beforeFilter in the AppController class given right at the start?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Francisco</title>
		<link>http://www.actionshrimp.com/2009/04/cakephp-pagescontroller-with-admin-routing/comment-page-1/#comment-6143</link>
		<dc:creator>Francisco</dc:creator>
		<pubDate>Sun, 17 May 2009 22:41:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.actionshrimp.com/?p=272#comment-6143</guid>
		<description>Hi. I was trying to make it work in cakephp 1.2, but it didn&#039;t. I did exactly the example in a test app but no succeded.
I would like to make an admin home page with login in my app.

Thank you.</description>
		<content:encoded><![CDATA[<p>Hi. I was trying to make it work in cakephp 1.2, but it didn&#8217;t. I did exactly the example in a test app but no succeded.<br />
I would like to make an admin home page with login in my app.</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

