companies_controller.php:
-
<?php
- class CompaniesController extends AppController {
- var $name = 'Companies';
- function index() {
- $this->set('companies', $this->Company->findAll()); }
- function view($id = null)
- { $this->Company->id = $id;
- $this->set('company', $this->Company->read()); }
- } ?>
company.php:
-
<?php
- class Company extends AppModel {
- var $name = 'Company'; }
- ?>
index.thtml:
-
<h1>Test companies</h1>
- <table> <tr>
- <th>Id</th> <th>company</th>
- <th>price</th> <th>change</th>
- <th>last update</th> </tr>
- <?php foreach ($companies as $company): ?> <tr>
- <td><?php echo $company['Company']['id']; ?></td> <td>







