Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // controller
- public function index()
- {
- $this->template->content = new View('pages/home');
- $this->template->content->content_showmany = new View('pages/contact_showmany');
- $this->template->content->content_showmany->contacts =
- ORM::factory('contact')
- ->select('id', 'firstname', 'lastname')
- ->orderby('firstname', 'ASC')
- ->find_all();
- }
- // pages/home
- <h3>View all your contacts</h3>
- <p><?php echo html::anchor('contact/add', 'Add a contact') ?></p>
- <?php echo $content_showmany ?>
- // pages/contact_showmany
- <table>
- <tr>
- <th>First</th>
- <th>Last</th>
- <th>Link</th>
- </tr>
- <?php foreach ($contacts as $contact): ?>
- <tr>
- <td><?php echo html::anchor('contact/view/'.$contact->id, html::specialchars($contact->firstname)) ?></td>
- <td><?php echo html::specialchars($contact->lastname) ?></td>
- </tr>
- <?php endforeach ?>
- </table>
Add Comment
Please, Sign In to add comment