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

  • Home
  • SEARCH
  • 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 8852823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:29:48+00:00 2026-06-14T13:29:48+00:00

I would like to know whether it’s possible to have something like this next

  • 0

I would like to know whether it’s possible to have something like this next line but with the exclusion of some actions. Because I would like to have manage, add, delete,… to go to the respective action and not to the display action. I know it’s possible by specifying these rules explicitely upfront, but if you have quite some of these it will not look to good in the router file.

 Router::connect('/paginas/manage', array('controller' => 'paginas', 'action' => 'manage')); 
 ...
 Router::connect('/paginas/*', array('controller' => 'paginas', 'action' => 'display'));

So the aim is to remove the first line…

Thanks.

  • 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-06-14T13:29:49+00:00Added an answer on June 14, 2026 at 1:29 pm

    Do something like this in your PaginasController which is basicly the PagesController I think.:
    ….

    public function display(){
    // Assuming default behavior of cakephp here
    ...
    if (!empty($path[0])) {
        $page = $path[0];
        if(
            method_exists($this, $page) &&
            !in_array(
                $page,
                array(
                    // Methods that never should be executed in this controller are going in here
                )
            )
        ){
            $this->{$page}();
        }
    }
    }
    

    This would execute a specific method in the controller. You could exit it there to make it stop working afterwards.
    This might be a bit dangerous though because it can access parent methods of AppController, too.

    The other way in which you also need exactly two of those Router::connect() rules one described here: http://api.cakephp.org/class/router#method-Routerconnect

    Router::connect(
      'paginas/:action/*',
      array(),
      array('paginas' => '(manage|add|delete)')
    );
    

    This one goes first followed by the other one. Never tested!

    Though I don’t see why there should be public methods for editing pages. Use these to seperate them from the rest: http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing

    I recommend, if you are trying to do this what I am thinking of, that you won’t start to write a management for pages using the PagesController. “Pages” is a more or less reserved word in cake and you can get in big trouble with using those words (wrote a “File” plugin once including a “File” model. Waste of time as if since cake1.2 or 1.3 there is actually a “File” class to handle file operations). Create something new like “ContentPage” or whatever for it. You are on a saver side then. This paragraph is maybe useless, because your controller is not even named “Pages”, but I hate to delete long ones, so it stays, just in case you need this information once.

    Also i recommend not to change programming language, which means, you either use english or spanish or whatever but not both or worst more. You could name your route whatever you want to, but the class names should maybe stay in english because cake is also.

    Greetings
    func0der

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

Sidebar

Related Questions

I would like to know whether this is actually possible in Android? When Android
I would like to know whether something like this can be easily achieved, any
I would like to do the following. I don't know whether it's possible to
i would like know some reference. I know i can googling it. but prefer
I would like to know whether it is possible to use a SELECT statement
I would like to know whether it a possible to detect whether a HTML
I would like to know whether it is possible to post topics for Discussion
I would like to know whether this MySql statement will be executed correctly, SELECT
I would like to know whether there might be any possibility of some performance
I would like to know whether it is possible or if there is a

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.