I'm using php pagination to load different data from a text file. I am using a jquery carousel http://tympanus.net/Development/Elastislide/index4.html that is featured on each page created from the pagination. What I would like to do is, depending on which page you are on, the carousel will load in a different position. To get this working, I'm thinking I would need to change the jquery which loads on each created page?
<script type="text/javascript">
$('#carousel').elastislide({
imageW : 110,
margin : 20,
border : 4,
easing : 'easeInBack',
current : 12
});
</script>
So if the pagination is on the page.php?p=12, the carousel would be on thumbnail 12? Example html:
<div id="carousel" class="es-carousel-wrapper">
<div class="es-carousel">
<ul>
<li><a href="page.php?p=1"><img src="images/img1.jpg" width="100" height="130" alt="image01" /></a></li>
<li><a href="page.php?p=2"><img src="images/img2.jpg" width="100" height="130" alt="image02" /></a></li>
</ul>
</div>
</div>
the pagination i'm using:
<?php
$data=file("students.txt");
$pages=0;
foreach($data as $temp){
$x=explode("|",$temp);
if($x[0]>0){
$pages=$pages+1;
}
}
if($_GET['p']){
$page=$_GET['p'];
}
if($_GET['i']){
$index=$_GET['i'];
}
if($index == "p"){
$page=$page-1;
}
if($index == "n"){
$page=$page+1;
}
if($page < 1){
$page=1;
}
if($page > $pages){
$page=$pages;
}
$line=$data[$page-1];
$fields=explode("|",$line);
?>
I'm new to PHP and I really don't have a clue on how to put this together...
Does anyone have any ideas how to make this work? :(