This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ArtigosController extends AppController { | |
//public $scaffold; | |
public $uses = array('Artigo'); | |
public function listar($page) { // Busca todas as notícias | |
$this->Artigo->page = $page; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router::connect('/hartigozz/lizztar/:page', array('controller' => 'artigos', 'action' => 'listar'), // o problema é que os links na paginacao nao acompanham essa regra!!! | |
/*Router::connect('/artigos/listar/:page', array('controller' => 'artigos', 'action' => 'listar'),*/ | |
array( | |
'pass' => array('page'), // Passa "page" pra action | |
'page'=>'[0-9]+' | |
)); | |
Router::connect('/artigos_lista', array('controller' => 'artigos', 'action' => 'listar')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($artigos AS $row) | |
{ | |
$nome_artigo = $row['Artigo']['nome']; | |
$data_artigo = $row['Artigo']['data']; | |
$url_artigo = $row['Artigo']['url']; | |
echo CakeTime::format($data_artigo, '%d-%m-%Y'); // formatacao de data via classe nativa CakeTime | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CONTROLLER | |
public function listarPorCategoria($categoria_id, $page = 1) { | |
$params = array( | |
'fields' => array('Empresa.*'), | |
'conditions' => array( | |
'Empresa.categoria_id' => $categoria_id, | |
'Empresa.visivel' => 'S' | |
), |