Thesneakerheadsociety.files.wordpress.com
Annotated MVC Source Code for PhotosMODEL//////////this is the model for the photo database <?phpApp::uses('AppModel', 'Model');class Photo extends AppModel {public $name = 'Photo';}?>VIEW/////////////this view file displays my gallery in a table <table id="gallery"><tr><?php $columns = 0; ?><?php foreach ($photos as $photo): ?><td>////////////displays thumbnails from the database//////////// the thumbnails calls the controller to run the view method<?php echo $this->Html->image($photo['Photo']['thumbnail'], array('url' => array( 'controller' => 'photos', 'action' => 'view', $photo['Photo']['id']), 'class' => 'resize')); ?></td>///////// organizes the data in 4 collumns<?php $columns++;if ($columns == 4){$columns = 0;echo "</tr>";echo "<tr>";}?><?php endforeach; ?><?php unset ($photo); ?></tr></table>CONTROLLER<?phpclass PhotosController extends AppController {public $helpers = array('Html', 'Form');////////////////this function creates the default index methodpublic function index() {$this->set('photos', $this->Photo->find('all'));}////////////////this function shows photos from the database by the photos IDpublic function view ($id = null) {if(!$id){throw new NotFoundException (__('Photo not found'));} $photo = $this->Photo->findById($id);if(!$photo){throw new NotFoundException (__('Photo not found'));}$this->set('photo', $photo);}}?> ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- wordpress passing data between pages
- wordpress business templates
- wordpress rss feed not working
- wordpress jquery is not defined
- create wordpress blog
- wordpress roles editor
- wordpress full rss feed
- wordpress rss feed settings
- wordpress rss feed plugin
- wordpress display rss feed
- wordpress rss feed link
- wordpress rss feed to post