Skip to content

Instantly share code, notes, and snippets.

@hugofabricio
Created October 7, 2013 16:34
Show Gist options
  • Select an option

  • Save hugofabricio/6870900 to your computer and use it in GitHub Desktop.

Select an option

Save hugofabricio/6870900 to your computer and use it in GitHub Desktop.
// Controller
$this->Paginator->settings = array('limit' => 1);
$tasks = $this->paginate('Task');
// Set
$this->set(
array(
'title_for_layout' => 'Ranking',
'tasks' => $tasks
)
);
// AppController
public $components = array(
'Auth',
'Session',
'Cookie',
'RequestHandler',
'Paginator'
);
/**
* Helpers utilizados na aplicação
*/
public $helpers = array(
'Html',
'Form' => array('className' => 'BoostCakeForm'),
'Session',
'Active',
'Js',
'Paginator'
);
// View (Apenas parte das provas)
<section id="provas" class="section">
<?php
$this->Paginator->options(array(
'update' => '#provas',
'evalScripts' => true,
));
?>
<?php foreach ($tasks as $result): ?>
<?php echo $result['Task']['name']; ?>
<?php endforeach; ?>
<div id="pagination">
<?php echo $this->Paginator->numbers(array('tag'=>'li','separator'=>'')); ?>
</div>
<?php echo $this->Js->writeBuffer(); ?>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment