Skip to content

Instantly share code, notes, and snippets.

@kleberksms
Created December 2, 2013 19:49
Show Gist options
  • Save kleberksms/7756990 to your computer and use it in GitHub Desktop.
Save kleberksms/7756990 to your computer and use it in GitHub Desktop.
//View
<?php
foreach ($response->subcategory as $subcategory) {
$s = $subcategory->subcategory;
echo "Imagem: <img src='{$s->thumbnail->url}'><br />";
echo "Nome: {$s->name}<br />";
echo "link da subcategoria: {$this->Html->link($s->name, array(
'controller' => 'categories',
'action' => 'getCategories',
'categoryId' => $s->id,
)
)
} <br />";
echo "link para as produtos de: {$this->Html->link('Todos os Produtos', array(
'controller' => 'products',
'action' => 'getProducts',
'categoryId' => $s->id,
)
)
} <br />";
echo "link para as produtos de: {$this->Html->link('Todas as ofertas', array(
'controller' => 'offers',
'action' => 'getOffers',
'categoryId' => $s->id,
)
)
} <br />";
echo "<br /><br />";
}
?>
//Routes
<?php
Router::connect('/', array('controller' => 'categories', 'action' => 'getCategories'));
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
Router::connect('/categoria/:id', array('controller' => 'categories', 'action' => 'getCategories'), array(
'pass' => array('id'),
'id' => '[0-9]+'
));
Router::connect('/produtos/:id', array('controller' => 'products', 'action' => 'getProducts'), array(
'pass' => array('id'),
'id' => '[0-9]+'
));
Router::connect('/ofertas/:id', array('controller' => 'offers', 'action' => 'getOffers'), array(
'pass' => array('id'),
'id' => '[0-9]+'
));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment