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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:49:18+00:00 2026-05-29T14:49:18+00:00

I have a problem here with cakePHP. I have 4 .ctp view pages that

  • 0

I have a problem here with cakePHP. I have 4 .ctp view pages that I want to send information to from my controller. These are not static pages, they are actually dynamic pages with user forms where the user can enter informations. I have a situation where I have to send the same array to the 4 different views (because part of each view needs that array to display the same information, in order words, I want to display the same information on 4 different views). I know that normally I’m supposed to have 1 view per controller actions, but this time I don’t want to create 4 similar actions for each of my views (because like I said, all I’m doing is sending an array to each of my 4 view files). How do I go about doing this without creating 4 repetitive actions in my controller for my 4 view files. I hope it’s clear enough what I’m trying to do here.

thank you

  • 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-29T14:49:19+00:00Added an answer on May 29, 2026 at 2:49 pm

    You can simply use one action in the controller and render different views based on some logic:

    public function my_action() {
        $this->set('myVar1', ...);
        $this->set('myVar2', ...);
        $this->set('myVar3', ...);
    
        if (/* something */) {
            $this->render('foo'); // renders my_controller/foo.ctp
        } else if (/* or other */) {
            $this->render('bar');
        } ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, have a slight problem here. In CakePHP I have a controller that
I have a problem here. My Zend_Forms do not render in view script. Via
I'm having a strange problem here... I have an ASP.NET 3.5 application that has
I'm not really sure if there is a single problem here or I have
i have a problem here, i want to make a multiple toolbar which works
I have a problem here, which I've not come across before and can't seem
I have a problem identical to this problem here . I even want to
I have forms inside a cakephp app that load through ajax. These forms have
I have a problem here. I have three parameters which I want to check
I have some redirects in place from our previous site that used CakePHP. The

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.