class NewsdeskController extends AppController { var $name = 'Newsdesk'; var $uses = array ('Newsadmin','Makepage','Sponsorship','Heroe'); var $helpers = array('Time'); var $paginate = array('limit' => 5, 'page' => 1,'order'=>array('date'=>'desc')); function index () { //array which contains every data of Newsadmins table matched to the appelmodel Newsadmin $this->set('newsdesks', $this->paginate('Newsadmin')); $this->set('pagescontents', $this->Makepage->findAll()); // retrieving data from the database $sql="select count(*) as sponsors from sponsorships"; $result = $this->Sponsorship->query ($sql); $this->set("counter",$result [0][0]['sponsors']); $sql ="select * from heroes where makepages_id='newsdesk'"; $this ->set ("heroescontent",$this->Heroe->query ($sql)); $this->set ("top",array ()); $this->set ("middle",array ()); $this->set ("bottom",array ()); } } ?>