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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:24:40+00:00 2026-05-27T04:24:40+00:00

Morning guys, So this is my first time developing a plugin for CakePHP. Here’s

  • 0

Morning guys,

So this is my first time developing a plugin for CakePHP. Here’s what I am doing in startUp of the component.

//component
function startUp(&$controller){
    //....
    if($render){
        $controller->render("return", "ajax");
    }
}

By default render will look at app/views/<controllers>/return.ctp and app/views/layouts/ajax for this render call.

Is there anyway that I can give a directive to render from app/my_plugin/views/awesome_stuffs/return.ctp and app/my_plugin/views/layout/ajax.ctp instead?

I believe the third param of Controller::render($file, $layout, $file) could do the job, but is there any better Cake way of doing things?

Plus, is that considered a good practice to take over controller’s rendering function like that?

  • 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-27T04:24:40+00:00Added an answer on May 27, 2026 at 4:24 am

    One way is to call the PLUGIN controller/action URL in your AJAX call, instead of the main app controller/action URL.

    ex:
    instead of:

    http://domain.com/controller/action
    

    you call:

    http://domain.com/my_plugin/controller/action
    

    When you do it this way, the plugin views & layouts are called automagically. See:

    http://book.cakephp.org/view/1118/Plugin-Tips

    http://book.cakephp.org/view/1115/Plugin-Views

    Otherwise, the only way I know of is manually setting paths as you mentioned or controller-wide via:

    var $viewPath = 'path/to/plugin/views/';
    var $layoutPath = 'path/to/plugin/layouts/';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hai guys, My fellow developers were talking about lambda expressions this morning. So i
Good morning guys. In error_log CakePHP is accusing the following: 28/11/2011 10:13:27 Error: [MissingControllerException]
Hai Guys, My application deals scheduled mail concept (i.e) every morning 6.00 am my
Hai guys, I want to send scheduled mail every morning from my application and
Good morning! I would like to ask some help from you guys on how
Morning y'all This is probably an easy one but I barely got any sleep
This morning, I was reading Steve Yegge's: When Polymorphism Fails , when I came
This morning I ran into an issue with returning back a text string as
Morning/Afternoon guys. Writing some JQuery AJAX shizz and getting a bit stuck. I've got
Morning all, Theres a few questions around this but none that really answer my

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.