Here you have a Hand-made pagination system
function photos($limite=0)
{
$result = $this->Fotografia-
>findAll(array('galeria_id'=>'1',"COUNT(*) count");
$this->set('number',$result[0][0]['count']);
$sql = 'SELECT id,text,file FROM fotografias WHERE galeria_id = 3
ORDER BY id ASC LIMIT '.$limite.',10';
$this->set('imagenes',$this->Fotografia->query($sql));
$temp=0;
$numpag=1;
if ($limite == 0) { $this->set('actual',$numpag); }
$pages = array();
$tempag = array('number' => '1','limite' => '0');
array_push($pages,$tempag);
for ($i=1;$i<$result[0][0]['count'];$i++)
{
$temp++;
if ($temp==10)
{
$limitetemp = $numpag*10;
$numpag++;
$tempag = array('numero' => $numpag,'limite' => $limitetemp); if
($limite == $limitetemp) { $this->set('actual',$numpag); }
array_push($pages,$tempag);
$temp=0;
}
}
$this->set('pages',$pages);
$this->set('last',$numpag);
}
Rohman
http://www.rohmansama.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---