Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3348634
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:33:59+00:00 2026-05-18T01:33:59+00:00

I am working in cakephp, and I have the following two lines in my

  • 0

I am working in cakephp, and I have the following two lines in my /app/config/routes.php file:

/**
 * ...and setup admin routing
 */
 Router::connect('/admin/:controller/:action/*', array('action' => null, 'prefix' => 'admin', 'admin' => true, 'layout' => 'admin' ));
/**
 * ...and set the admin default page
 */
 Router::connect('/admin', array('controller' => 'profiles', 'action' => 'index', 'admin' => true, 'layout' => 'admin'));

I also have a layout at /app/views/layouts/admin.ctp

However, the layout is not changed when I visit admin URLs

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:33:59+00:00Added an answer on May 18, 2026 at 1:33 am

    Create a app/app_controller.php and put this in:

    <?php
    class AppController extends Controller {
    
        function beforeFilter() {
            if (isset($this->params['prefix']) && $this->params['prefix'] == 'admin') {
                $this->layout = 'admin';
            } 
        }
    
    }
    

    Don’t forget to call parent::beforeFilter(); in your controllers if you use it in other controllers.

    Semi related to the question, you don’t need the routes defined, you just need to enable Routing.admin config option and set it to admin in the app/config/core.php. (CakePHP 1.2)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using CakePHP 1.3, I have the following layout: /srv/www/_cakephp13/ /app/ /cake/ /plugins/ /vendors/ etc...
I have the following in a layout file; <?php $Filename = TheEvent.vcs; header(Content-Type: application/force-download);
I am working on CakePHP, and I have my app working in my localhost.
I've been working in CakePHP and I got the following problem. I have a
I've got the following routes.php configuration Router::connect('/:type/:slug;:id', array( 'controller' => 'content', 'action' => 'show',
I am working on a project in cakephp.For the view part,I have the following
I have a cakePHP app working at http://domain1.com/domain2 , and want to point http://domain2.com/
I have a CakePHP (latest version) web app with forms and validation all working
I'm working on a CakePHP 1.2 app where I don't have control over the
I’m working on cakephp 1.3. I’m finding issue in character encoding. I’ve two model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.