MVC / ModelBaker / CakePHP problem

Discussion in 'PHP' started by fulltilt, Feb 1, 2009.

  1. #1
    First things first, I don't really know my way around MVC yet.

    I'm using ModelBaker (http://www.widgetpress.com/) to build a custom site, it uses the CakePHP structure behind the scenes - and I have no experience in Cake either BUT using ModelBaker I've created my Models, the relationship to them and built the app successfully (which I think is baked in CakePHP terms).

    The app works well, but now I need to customise the ctp files to work the way I want them to work - am I allowed to do that ?

    The app is about buildings, and the main page at you see (at the moment) provides links to the normal CRUD functions, but instead I what the page to display the contents of my building Model - can someone please tell me how to do this ?, because I can't make it work.

    Cheers :)

    PS I'm happy to provide the file contents, I just don't know which file (or lines) to post yet.
     
    fulltilt, Feb 1, 2009 IP
  2. fulltilt

    fulltilt Peon

    Messages:
    128
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I came up with this code, but it still doesn't display any data from the database :

    
        <?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>
    
    Code (markup):
     
    fulltilt, Feb 2, 2009 IP