Are you getting an empty table? Or, is Cake running into an error and
not continuing to output anything?

If the former, it's likely that you haven't set a var named
'restaurants'. You need $this->set('restaurants', ...); in your
controller action.

On Mon, Feb 2, 2009 at 6:45 AM, Chris Mc <[email protected]> wrote:
>
> Hi,
>
> I'm stuck :( I have been using ModelBaker to create my app and it went
> extremely well until I wanted to start customising the code.  I'm
> learning CakePHP and MVC at the moment, but I've exceeded my curent
> knowledge (which is pretty easy at the moment).  Anyway, I've been
> trying to customise the root of my homepage with code like this:
>
>    <?php echo $form->create('Restaurant'); ?>
>    <div id="gridWrapper">
>    The home page ...
>       <table id="datagrid">
>          <tbody>
>          <?php foreach ($restaurants as $restaurant): ?>
>             <tr>
>                <td class="name"><?php echo $restaurant['Restaurant']
> ['name']; ?></td>
>                <td class="address_1"><?php echo $restaurant
> ['Restaurant']['address_1']; ?></td>
>                <td class="address_2"><?php echo $restaurant
> ['Restaurant']['address_2']; ?></td>
>                <td class="city"><?php echo $restaurant['Restaurant']
> ['city']; ?></td>
>                <td class="state"><?php echo $restaurant['Restaurant']
> ['state']; ?></td>
>                <td class="zip"><?php echo $restaurant['Restaurant']
> ['zip']; ?></td>
>             </tr>
>          <?php endforeach; ?>
>          </tbody>
>       </table>
>    </div>
>
>
> but it doesn't work :( .  It shows the "The home page ... " message
> and that's it.
>
> What am I missing ?
> What do I need to code to make it work ?
> Where can I read about this ?
>
> Cheers,
> Chris :)
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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