View previous topic :: View next topic |
Author |
Message |
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Wed Feb 07, 2007 6:06 am Post subject: php?id |
|
|
how to make pages like php?id=14&this=that |
|
Back to top |
|
|
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Wed Feb 07, 2007 10:39 am Post subject: |
|
|
Learn PHP. No easier way. |
|
Back to top |
|
|
hc2995 -
Joined: 07 Aug 2006 Posts: 644 Location: Maryland, USA
|
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Thu Feb 08, 2007 8:36 am Post subject: |
|
|
ok i got that figerd out but need to know how to auto gen the links |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Thu Feb 08, 2007 10:51 am Post subject: |
|
|
i need help with this
Code: | <?php
switch ($page) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
default:
echo "i is not equal to 0, 1 or 2";
}
if(!$page)
{
$page=1;
}
$max=5;
$num=$page * $max - $max;
$totalpage = ceil($lines/$max)+1;
if ($page > 1) {
echo "<a href=\"?page=".($page-1)."\">[Prev]</a> \n";
}
for($i=1; $i<$totalpage; $i++) {
if ($i == $page) {
echo "<b>[$i] </b>\n";
} else {
echo "<a href=\"?page=".$i."\">[$i]</a> \n";
}
}
if ($page < $totalpage-1) {
echo "<a href=\"?page=".($page+1)."\">[Next]</a>\n";
}
?> |
|
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Fri Feb 09, 2007 3:09 am Post subject: |
|
|
any help ? |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Fri Feb 09, 2007 7:43 pm Post subject: |
|
|
the bottom of the code is Pagination i am haveing problems with |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Feb 09, 2007 7:55 pm Post subject: |
|
|
What exacly is the problem with your code? What problems are you having with it? Can you tell us where you got this code from? |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Sat Feb 10, 2007 12:02 am Post subject: |
|
|
this is the page layout
Code: | <?php
switch ($page) {
case 0:
include("page0.php");
break;
case 1:
include("page1.php");
break;
case 2:
include("page2.php");
break;
default:
include("home.php");
}
?> |
and the pagination that is suppose to do like Prev Next links by counting the case inthe top code page lay out but the links aint showing up
Code: | <?php
if(!$page)
{
$page=1;
}
$max=5;
$num=$page * $max - $max;
$totalpage = ceil($lines/$max)+1;
if ($page > 1) {
echo "<a href=\"?page=".($page-1)."\">[Prev]</a> \n";
}
for($i=1; $i<$totalpage; $i++) {
if ($i == $page) {
echo "<b>[$i] </b>\n";
} else {
echo "<a href=\"?page=".$i."\">[$i]</a> \n";
}
}
if ($page < $totalpage-1) {
echo "<a href=\"?page=".($page+1)."\">[Next]</a>\n";
}
?> |
i would give the link to where i got the code but aint shure about the rules on this forum these days |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sat Feb 10, 2007 5:33 am Post subject: |
|
|
I believe you need to enable "registered_globals = On" in your php.ini file. I don't see how $page can send any data to the script.
Try this instead:
Code: | <?php
$page = $_GET['page'];
switch ($page) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
default:
echo "i is not equal to 0, 1 or 2";
}
if(!$page)
{
$page=1;
}
$max=5;
$num=$page * $max - $max;
$totalpage = ceil($lines/$max)+1;
if ($page > 1) {
echo "<a href=\"?page=".($page-1)."\">[Prev]</a> \n";
}
for($i=1; $i<$totalpage; $i++) {
if ($i == $page) {
echo "<b>[$i] </b>\n";
} else {
echo "<a href=\"?page=".$i."\">[$i]</a> \n";
}
}
if ($page < $totalpage-1) {
echo "<a href=\"?page=".($page+1)."\">[Next]</a>\n";
}
?>
|
|
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Sat Feb 10, 2007 6:38 am Post subject: |
|
|
the bottom of the code aint working pagination is what i am haveing problms with |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Sat Feb 10, 2007 3:37 pm Post subject: |
|
|
did a little work on the bottom code last night & it ran up my mem usage
to 9,653,865 in ie
Code: | <?php
if (!$page) { $page = 1; }
$max = 5;
$num = $page * $max - $max;
$totalpage = ceil($lines/$max)+1;
if ($page > 1) {
echo "<a href=\"?index=".($page-1)."\">[Prev]</a> \n"; }
for($i=1; $i >= $totalpage; $i++) {
if ($i = $page) {
echo "<b>[$i] </b>\n";
} else {
echo "<a href=\"?index=".$i."\">[$i]</a> \n"; } }
if ($page < $totalpage-1) {
echo "<a href=\"?index=".($page+1)."\">[Next]</a>\n"; }
?> |
|
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Sat Feb 10, 2007 5:04 pm Post subject: |
|
|
If I were you, I'd just make links for your different pages manually.
Using a for loop to genereate links is useful only if your link names have a set naming scheme (Page 1, Page 2, ...).
BTW, all the links work like index.php?page=2
I changed the code around a little bit --> http://stephen.calvarybucyrus.org/codebin/5
You should be able to use it "right out of the box".
PS For more pages, just add another case statement before the default, and add another function - like page7().
Hope it helps. _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org
Last edited by pkSML on Wed Feb 14, 2007 1:35 pm; edited 2 times in total |
|
Back to top |
|
|
roganty -
Joined: 08 Jun 2004 Posts: 357 Location: Bristol, UK
|
Posted: Sun Feb 11, 2007 12:09 am Post subject: |
|
|
One little q!
What is the value of $lines, and where does it get this value from?
Code: | $totalpage = ceil($lines/$max)+1; |
_________________ Anthony R
Roganty | Links-Links.co.uk |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Sun Feb 11, 2007 1:57 am Post subject: |
|
|
i see but i am lost there too ? |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Mon Feb 12, 2007 5:17 am Post subject: |
|
|
ok i got it to work but the next buttion is not working & it is skiping 1
like i got 0 < that dont show that is suppose to & 12345 showing & i got 678910 more pages
it dont go to them here is the code
Code: | <?php
if(!$page)
{
$page=0;
}
$max=5;
$num=$page * $max - $max;
$totalpage = ceil($lines = $max)+1;
if ($page = 1) {
echo "<a href=\"$_SERVER[PHP_SELF]?index=".($page-1)."\">[Prev]</a> \n";
}
for($i=1; $i <= $totalpage; $i++) {
if ($i == $page) {
echo "<b>[$i] </b>\n";
} else {
echo "<a href=\"$_SERVER[PHP_SELF]?index=".$i."\">[$i]</a> \n";
}
}
if ($page < $totalpage-1) {
echo "<a href=\"$_SERVER[PHP_SELF]?index=".($page+1)."\">[Next]</a>\n";
}
?> |
|
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Tue Feb 13, 2007 7:36 am Post subject: |
|
|
can any one help me with this script ? |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Wed Feb 14, 2007 11:11 am Post subject: |
|
|
any one ? |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Wed Feb 14, 2007 1:36 pm Post subject: |
|
|
pksml wrote: | If I were you, I'd just make links for your different pages manually.
Using a for loop to genereate links is useful only if your link names have a set naming scheme (Page 1, Page 2, ...).
BTW, all the links work like index.php?page=2
I changed the code around a little bit --> http://stephen.calvarybucyrus.org/codebin/5
You should be able to use it "right out of the box".
PS For more pages, just add another case statement before the default, and add another function - like page7().
Hope it helps. |
Did my script help you at all? I could customize it if you'd like.
It looks like you just want links to be generated at the bottom of each page like this:
[Prev] (show all pages) [Next] ??? _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Wed Feb 14, 2007 2:47 pm Post subject: |
|
|
Here ya' go!
http://code-bin.homedns.org/codebin/9
This code will generate links to pages ahead and previous
Code: | // Just set these variables
$totalpages = 16; // How many pages you have
$backpages = 3; // How many links to previous pages you want to see
$forwpages = 6; // How many links to pages ahead you want to see |
_________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
Override -
Joined: 25 Nov 2003 Posts: 124 Location: Virtual Abyss N Area 61
|
Posted: Thu Feb 15, 2007 10:20 am Post subject: |
|
|
ty |
|
Back to top |
|
|
|