1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
// Dans ton controlleur
function annonceursAction()
{
$this->view->layout()->setLayout('1column');
$this->view->headLink()->appendStylesheet(DEFAULT_SKIN_PATH . 'styles/recherches.css');
$tAgences = new Agences();
$field = "agence_rs";
// J'envoie les parametres à la methode de la table
$this->view->letter = $this->_request->getParam('letter');
$this->view->data = $this->AlphabeticArrayMaker($tAgences->getAllAgencesForSeo($this->view->letter),$field);
}
// Dans ta classe de table
public function getAllAgencesForSeo($letter)
{
$alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$select = "Ta requete";
if ($letter && in_array($letter, $alphabet)) {
$select .= " WHERE agence_rs LIKE '{$params['letter']}%'";
}
}
// Dans ta vue
<?php
$alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
foreach ($alphabet as $letter) {
if ($letter == $this->letter) {
echo $letter;
} else {
echo '<a href="'. $this->url(array(
'controller' => 'index',
'action' => 'annonceurs',
'lettre' => $letter
)) . '">' . $letter . '</a>';
}
?> |