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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:57:04+00:00 2026-05-27T12:57:04+00:00

Please bear with me as I am a cakephp noob. I have this app

  • 0

Please bear with me as I am a cakephp noob. I have this app that should go to http://www.name.com/complexes/somecomplex/unitnumber. I can correctly get it to advance to http://www.name.com/complexes/somecomplex, but I don’t know how to get the full path to my unit number.

Here is my controller:

class ComplexesController extends AppController {
    public $name='Complexes';
    public $uses=array('User', 'Complex', 'Unit');
    public $layout='pagelayout';



    public function view() { 
    $this->set('complex', strtoupper($this->params['id']));
    $c=$this->Complex->find('first', array('conditions'=>array('complex_name'=>$this->params['id'])));
    $this->set('complex_data', $c);
}

}

and here is my route

Router::connect('/complexes/:id', array('controller' => 'complexes', 'action' => 'view'));

Where do I write the action for calling up a specific unit? Inside my ‘view’ action or another action called ‘unit’? And how do i tell cake to route to 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-27T12:57:05+00:00Added an answer on May 27, 2026 at 12:57 pm

    I figured it out! I had to pass an argument, called $unit in my view() function, where I set the conditions to look for the unitnumber that I had entered in the url ($unit). so, my code ended up looking like this:

    public function view($unit=null) { 
        $this->set('complex', strtoupper($this->params['id']));
        $c=$this->Complex->find('first', array('conditions'=>array('complex_name'=>$this->params['id'])));
        $this->set('complex_data', $c);
        $u=$this->Unit->find('first', array('conditions'=>array('unitnum'=>$unit)));
        $this->set('unit', $u);
    }
    

    and in my routes file I added this line:

    Router::connect('/complexes/:id/*', array('controller' => 'complexes', 'action' => 'view'));
    

    And it worked!

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

Sidebar

Related Questions

I'm kinda noob to android so please bear with me. I'm currently developing app
This is kinda confusing so please bear with me. I have an array (listOfStates)
Please bear with me -- I know this is complex. I have a table
I am new to WPF/XAML so please bear with the noob question. I have
Please bear with me if this question isn't well formulated. Not knowing is part
I am new to bash so please bear with me if this is a
Please bear with me as I've been thrown into the middle of this project
I am new to iOS development so please bear with me. I have created
Please bear with me Silverlight Designer Gurus, this is compicated (to me). I'm creating
Please bear with me, my apologies if this post is too long... I'm attempting

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.