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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:36:13+00:00 2026-05-27T03:36:13+00:00

I am a newbie in Cake PHP, and I need to transform my html

  • 0

I am a newbie in Cake PHP, and I need to transform my html website to use CakePHP. I am having trouble understanding how it works, but i know that if I make one piece work I should be able to continue building it, I just need that initial help hand that I havent been able to clearly understand in the tutorials. So here is a small scenario from my website

I have a MySql Table called cars, this table has the following values

car_id
car_name
car_description
car_price

in app/controllers i created my control cars_controller.php

<?php
    class CarsController extends AppController {

        var $name = 'Cars';

      }
?>

in my model I created a Car.php

<?php
class Car extends AppModel{

    var $name = 'Car';
 }
?>

What I am having issues with, is now… how can I show these cars, how do I set up a view to just show these cars?.. Usually what I did was just had a show_cars.php that had all the mysql logic in there to pull the data and then pass the results to my showcars.html or showcars.php but now I am totally lost, I tried watching YouTube, went to cakephp.org . Still I am not able to understand. Also once I get the cars, how should I type the url (I am in locahost) to access this view?

Any help, will be much appreciated.

  • 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-27T03:36:13+00:00Added an answer on May 27, 2026 at 3:36 am

    Try in your controller:

    class CarsController extends AppController {
      var $name = 'Cars';
      //use model Car
      var $uses = array("Car");
    
      public function list() {
        $carList = $this->Car->find("all");
        //set to display for view list.ctp inside Car folder
        $this->set("list_cars", $carList);
      }
    }
    

    Now create list.ctp file inside Car folder (this is the view) and do:

    print_r($list_cars); // this will show up array of rows from your table
    

    For more info check: http://book.cakephp.org/

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

Sidebar

Related Questions

CakePHP Newbie :) I am having trouble accessing another controller and passing that data
I am a newbie to php and cakephp, recently I was assigned a job
I'm a newbie to CakePHP but got strange error. I'm just testing it, how
I'm creating a website using the cakePHP framework and I and a newbie to
Newbie question... The objective: I intend to have an HTML text input field as
Newbie question: There are three types of Asp.Net controls : HTML server controls, Web
I am learning cakephp in an autodidact manner and I am a complete newbie
Newbie here programming my first app (having made several tutorial apps). I am using
Newbie question. I am trying to use ActiveRecord::Base.connection.execute(..) in a ruby 3.1 app and
Newbie here. The following function works fine when $color refers to an entry in

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.