I am creating a gallery in my web page. In my web I also have some views in where I use some widgets like CGridView or CListView. In these views, when there are many elements in the page, automatically appear a pagination bar. Of course I created theese views using Yii, and the problem is that I don't know how to create this kind of pagination in my gallery view. For this reason, I searched for a pagination code on internet and I found some things. Now I am using this code
<div class="pagination">
<ul>
<?php
echo "<a href=\"?pag=".'1'."\" onclick=\"Pagina('1')\"><< Primero </a> ";
if($pag_act>1) echo "<a href=\"?pag=".$pag_ant."\" onclick=\"Página('$pag_ant')\"> < Anterior</a> ";
for ($l=$pag_act;$l<=$pag_ult;$l++){
echo "<a href=\"?pag=".$l."\" onclick=\"Página('$l')\"> $l</a> ";
}
if($pag_act<$pag_ult) echo " <a href=\"?pag=".$pag_sig."\" onclick=\"Pagina('$pag_sig')\">Siguiente > </a> ";
echo "<a href=\"?pag=". $pag_ult."\" onclick=\"Pagina('$pag_ult')\">Último >> </a>";
?>
</ul>
</div>
Of course, I edited the code because I wanted that this display a pagination bar similar than the created by Yii in another views as I told you.
In the end, my pagination bar is similar the created by Yii but they don't work in the same way. For example, my pagination bar show "myApp/site/gallery.html?pag=1" in the URL, when I click a button it doesn't change his color background and the most important, when I click on a button the page is refreshed and you display the begining of this, I mean, the tittle, not the pagination bar.
I know that to change the background color I have to edit the css, in my case, in navi.css I have:
/* ----------------------------------------------Pagination-------------------------------------*/
.pagination{display:block; width:100%; text-align:center; clear:both;}
.pagination ul{margin:0; padding:0; list-style:none;}
.pagination li{display:inline;}
.pagination .next{margin:0;}
.pagination a{display:inline-block; padding:2px 5px 3px 5px; margin:0 2px 0 0; border:1px solid #DFDFDF;}
.pagination .current, .pagination .splitter{padding:6px; margin:0 2px 0 0;}
.wrapper .pagination a:hover, .pagination .current, .pagination .splitter{color:#9B9B9B!important; background-color:#F9F9F9;}
.pagination ul li.selected a{color:#666666!important; background-color: #F9F9F9;border:0;}
But I don't know that to do to change the background color of my pagination bar.
I would like that my pagination bar work as the created by Yii, or to know how to created another like the Yii pagination bar.
Please, someone could help me? ¡THANKS!
EDIT:
I use this code of gallery.php to display the images:
<div class="wrapper col2">
<div id="container" class="clear">
<!-- ####################################################################################################### -->
<div id="tabcontainer">
<ul id="tabnav">
<li><a href="#tabs-1">Wedding Photos</a></li>
<li><a href="#tabs-2">Artistic Photos</a></li>
<li><a href="#tabs-3">Children's Photos</a></li>
<li><a href="#tabs-4">Fashion Photos</a></li>
<li><a href="#tabs-5">Action Photos</a></li>
</ul>
<!-- ########### -->
<div id="tabs-1" class="gallery clear">
<ul>
<?php
while($imagen_a_empezar<$imagen_a_terminar){
if($imagen_a_empezar>=$total_imagenes) break;
if (in_array($imagen_a_empezar,$ultimos)){
?>
<li class="last"><a href="<?php echo Yii::app()->theme->baseUrl;?>/images/portfolioslider/<?php echo $archivos[$imagen_a_empezar]?>.jpg" rel="prettyPhoto[gallery1]" title=""><img src="<?php echo Yii::app()->theme->baseUrl; ?>/images/gallery/<?php echo $archivos[$imagen_a_empezar]?>.jpg" alt="" /></a></li>
<?php }else{ ?>
<li><a href="<?php echo Yii::app()->theme->baseUrl;?>/images/portfolioslider/<?php echo archivos[$imagen_a_empezar]?>.jpg" rel="prettyPhoto[gallery1]" title=""><img src="<?php echo Yii::app()->theme->baseUrl; ?>/images/gallery/<?php echo $archivos[$imagen_a_empezar]?>.jpg" alt="" /></a></li>
<?php };?>
<?php $imagen_a_empezar++;
};?>
</ul>
</div>
</div>
</div>
</div>