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 7014187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:29:19+00:00 2026-05-27T22:29:19+00:00

I wish to have a page called index with a corresponding url domain/controller/index and

  • 0

I wish to have a page called “index” with a corresponding url “domain/controller/index” and another
page called “admin_index” with a corresponding url “domain/admin/controller/index”.
The trick is that i want both pages to use the same view to render and the same function for the logic while on of the page’s parameters are a flag indicating to the view from which url the view is rendered.

I need it because currently in my “index” page I have table with data.
The page also has a smart filter for that page which requires a respectful amount of logic in the controller side.
My problem is that currently there is an “Edit” button in each line which I don’t want to share to all the users.

Currently I’m using the admin prefix to handle this kind of pages by protecting them by limiting the access from the web-server (Apache in my case).

Any ideas of how to implement this without duplicating the controller function?

  • 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-27T22:29:20+00:00Added an answer on May 27, 2026 at 10:29 pm

    Try this (I’ve tested it on my CakePHP 2.0.x app, but there’s nothing in this code that should be 2.0 specific):

    //controller
    public function index($admin = false) {
        $this->set(compact('admin'));
    }
    public function admin_index() {
        $this->index(true); //calls the index function to do all that stuff
        $this->render('index'); //tells it to render the 'index' view
    }
    

    When you hit the /index page, all should be as normal. When you hit the admin_index, it runs the logic from the index function, then specifies to use the index view.

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

Sidebar

Related Questions

I wish to have a page that has a fixed height (without scroll bars).
I have a Drupal theme called wellington located in \sites\all\themes\wellington. I wish to override
i have a php page, on that page i have text boxes and a
I have an app that has a 1 page with a DIV that changes
Here is i wish to do. I want to have multiple webview loading their
i am in a very tricky situation.. I have a page that is a
My page lets the user choose a list of courses that they wish to
I have a page in chrome which contains many textboxes and I wish to
I have a page that lets the viewer edit objects. The page displays a
I have a div called content which I wish to at least take up

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.