Hello PHP masters, I want to know whast the php page thing about, like ?page=2 or ?page5 something like that, I don't know for sure, I think you use less space and you work with one file, its just you hide files or something like that I just wanted to know, can you give me 1 short example.
Thank you.
PHP pageing
Moderator: General Moderators
Re: PHP pageing
Less space? One file? Hide files?
Sure, we can do examples, but you have to know what you want. Maybe pagination? URL rewriting?
Sure, we can do examples, but you have to know what you want. Maybe pagination? URL rewriting?
Re: PHP pageing
What you mean examples? OK here, I have 10 videos and I want to put them in one file, so if visitor clicks video 1 it shows only video one and i think on the URL it shows ?page= something like that with different numbers, but I have one file, so if I click second video and it hides first video and shows second, hide, I don't mean something like dissolve or something, it just reloads and shows ?page=2 for second video, something like that. I don't know if i explained the right thing or in clear way. Anyways thank you for help.
Re: PHP pageing
whatever is after a question mark is a variable. it can be as simple as "hello.php?firstname=John&lastname=Doe" would print out firstname and lastname, or as complex as session information, header, footer, content, template, css, etc... there is no limit. it's usually pulled from a database. in your case, it could be a template, calling a specific page content.
answer question?
answer question?
Re: PHP pageing
Yea but, my question was how to make those pages, to contain videos but hide them until I click to open.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: PHP pageing
These forums contain many pagination scripts discussions:
search.php?keywords=pagination&terms=al ... mit=Search
(you need to cut and paste because there are ['s in the URL)
search.php?keywords=pagination&terms=al ... mit=Search
(you need to cut and paste because there are ['s in the URL)
(#10850)
Re: PHP pageing
Try this may this will help you. Simple pagination code
It will be like this
<< | Previous | Next | >>
It will be like this
<< | Previous | Next | >>
Code: Select all
function pagingPN($sql, $page, $limit, $getvars, $class)
{
if ($page == "")
$page = 1;
if ($limit == 0)
$limit = $this->limit;
$tsql = $sql;
$result = mysql_query($tsql) or die("Error: ".mysql_errno().":- ".mysql_error());
$total = mysql_num_rows($result);
$totnumpages = ceil($total/$limit);
if ($offset < 0)
$offset = 0;
else
$offset = ($page - 1) * $limit;
$sql = $sql. " limit $offset, $limit";
$res = $this->select_row($sql);
$serial_no = ($page - 1) * $limit;
if ($total > 0)
{
$link = "";
if ($page > 1)
{
$link .= "<a href=".$_SERVER['PHP_SELF']."?page=1$getvars class='".$class."' title='Jump to First Page'><<</a> | ";
$prev = $page - 1;
$link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$prev."$getvars class='".$class."' title='Goto Previous Page'>Previous</a><span class='".$class."'> | </span>";
}
else
{
$link .= "<span class='".$class."' title='Jump to First Page'><<</span> | <span class='".$class."' title='Goto Previous Page'>Previous | </span>";
}
if ($page < $totnumpages)
{
$next = $page + 1;
$link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$next."$getvars class='".$class."' title='Goto Next Page'>Next</a> | ";
$link .= "<a href=".$_SERVER['PHP_SELF']."?page=".$totnumpages."$getvars class='".$class."' title='Jump to Last Page'>>></a>";
}
else
{
$link .= "<span class='".$class."' title='Goto Next Page'>Next</span> | <span class='".$class."' title='Jump to Last Page'>>></span>";
}
}
$retarr["sql"] = $sql;
$retarr["records"] = $res;
$retarr["serial_no"] = $_no;
$retarr["link"] = $link;
return $retarr;
}
Re: PHP pageing
Thank you for your help, but I don't get it, I am sorry but I think I need some PHP programming classes.