On Sun, Jun 21, 2009 at 1:20 PM, dflow<[email protected]> wrote:
>
> i have done some tutorials
> the scaffold works fine
>
> when i want to create my own view
> nothing is echoed here is the controller:
> <?php
>  class ProductsController extends AppController {
>  var $name = 'Products';
>
>  //var $scaffold;
>  function index() {
> $this->set('products',$this->Product->find('all'));
> }
>  }
>  ?>
>
> and the products/index.ctp view
>
> i get the hello and nothing blank screen with the default
> cake layout
> the code:
> <?php echo'hello';?>
>
> <html>
>  <head>
>  <title>test title</title>
>  </head>
>  <body>
>  <div id="container">
>  <div id="content">
> <?=$content_for_layout;?>
> <?php echo $product['Product']['id']; ?>
>  </div>
>  </div>
>  </body>
> </html>
>

That looks more like a layout than a view. It should be like:

// view file -- index.ctp:
<?php echo'hello';?>
<?php echo $product['Product']['id']; ?>

// layout file -- default.ctp
<html>
 <head>
 <title>test title</title>
 </head>
 <body>
 <div id="container">
 <div id="content">
<?=$content_for_layout;?>
 </div>
 </div>
 </body>
</html>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to