Page 1 of 1

Adding data from from url in Pagination Class

Posted: 18 May 2019, 18:02
by JanMolendijk
Chief I hope you don't get a headache from me

About a year and a half ago you added an id detection from url in the pagination class from coursesweb.net/php-mysql/pagination-class-script_s2
yesterday I spent 6 hours studying how you did that but I didn't find the solution.

I would like to have album + name from the url also
Album-Pictures.php?name=Guest&album=Nature

Code: Select all

<?php 
$album = isset($_GET['album']) ?(int) $_GET['album'] :'';

$name = isset($_GET['name']) ?(int) $_GET['name'] :'';
//your code ..
?>
The first page is normal working but when i skip to the second page &pg=1
I cant create $name $album into next pages

Code: Select all

<?php 
$files = glob("albums/upload/Show/Maps/$_GET[name]/$_GET[album]/*.*");
for ($i=0; $i<count($files); $i++)
{
$num = $files[$i];
}
?>
I need to do something in the class.pagination.pictures.album
but I really don`t know how what to do after many tryouts ???????

Code: Select all

  $re ='';         // the variable that will contein the links and will be returned
  $pg =($str=='')?'?pg=':'?'.$str.'&pg=';      // the name for the GET value added in URL

Adding data from from url in Pagination Class

Posted: 19 May 2019, 05:25
by Admin
The pagination class has a method getLinks(str) that returns the pagination links with the value from $str in href attribute.
In the place where you call that method to dispay the pagination links call it with data from url as argument, like this:

Code: Select all

$album = isset($_GET['album']) ?strip_tags($_GET['album']) :'';
$name = isset($_GET['name']) ?strip_tags($_GET['name']) :'';
$name_album ='name='.$name.'&album='.$album;

//outputs the pagination links
echo $objPg->getLinks($name_album);