php?id

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Wed Feb 07, 2007 6:06 am    Post subject: php?id Reply with quote

how to make pages like php?id=14&this=that
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Wed Feb 07, 2007 10:39 am    Post subject: Reply with quote

Learn PHP. No easier way.
Back to top View user's profile Send private message
hc2995
-


Joined: 07 Aug 2006
Posts: 644
Location: Maryland, USA

PostPosted: Wed Feb 07, 2007 1:10 pm    Post subject: Reply with quote

Andy (abyssunderground) made a script that can do www.BLAH.com/page.php?p=PAGE_YOU_WANT

Here is the page for it: http://www.abyssunderground.co.uk/scripts-phponefile.php

You could also make your own if you know php ;)
_________________
Where have i been? School got heck-tick, had to move half way around the state, then back... and then i had to change jobs, so iv been away for a while :P
Back to top View user's profile Send private message AIM Address
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Thu Feb 08, 2007 8:36 am    Post subject: Reply with quote

ok i got that figerd out but need to know how to auto gen the links
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Thu Feb 08, 2007 10:51 am    Post subject: Reply with quote

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>&nbsp;\n";
    }
    for($i=1; $i<$totalpage; $i++) {
        if ($i == $page) {
            echo "<b>[$i]&nbsp;</b>\n";
        } else {
            echo "<a href=\"?page=".$i."\">[$i]</a>&nbsp;\n";
        }
    }
    if ($page < $totalpage-1) {
        echo "<a href=\"?page=".($page+1)."\">[Next]</a>\n";
    }
?>
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Fri Feb 09, 2007 3:09 am    Post subject: Reply with quote

any help ?
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Fri Feb 09, 2007 7:43 pm    Post subject: Reply with quote

the bottom of the code is Pagination i am haveing problems with
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Feb 09, 2007 7:55 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Sat Feb 10, 2007 12:02 am    Post subject: Reply with quote

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>&nbsp;\n";
    }
    for($i=1; $i<$totalpage; $i++) {
        if ($i == $page) {
            echo "<b>[$i]&nbsp;</b>\n";
        } else {
            echo "<a href=\"?page=".$i."\">[$i]</a>&nbsp;\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 View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Feb 10, 2007 5:33 am    Post subject: Reply with quote

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>&nbsp;\n";
    }
    for($i=1; $i<$totalpage; $i++) {
        if ($i == $page) {
            echo "<b>[$i]&nbsp;</b>\n";
        } else {
            echo "<a href=\"?page=".$i."\">[$i]</a>&nbsp;\n";
        }
    }
    if ($page < $totalpage-1) {
        echo "<a href=\"?page=".($page+1)."\">[Next]</a>\n";
    }
?>
Back to top View user's profile Send private message Visit poster's website
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Sat Feb 10, 2007 6:38 am    Post subject: Reply with quote

the bottom of the code aint working pagination is what i am haveing problms with
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Sat Feb 10, 2007 3:37 pm    Post subject: Reply with quote

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>&nbsp;\n"; }
for($i=1; $i >= $totalpage; $i++) {
if ($i = $page) {
echo "<b>[$i]&nbsp;</b>\n";
} else {
echo "<a href=\"?index=".$i."\">[$i]</a>&nbsp;\n"; } }
if ($page < $totalpage-1) {
echo "<a href=\"?index=".($page+1)."\">[Next]</a>\n"; }
?>
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Sat Feb 10, 2007 5:04 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
roganty
-


Joined: 08 Jun 2004
Posts: 357
Location: Bristol, UK

PostPosted: Sun Feb 11, 2007 12:09 am    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Sun Feb 11, 2007 1:57 am    Post subject: Reply with quote

i see but i am lost there too ?
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Mon Feb 12, 2007 5:17 am    Post subject: Reply with quote

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>&nbsp;\n";
    }
    for($i=1; $i <= $totalpage; $i++) {
        if ($i == $page) {
            echo "<b>[$i]&nbsp;</b>\n";
        } else {
            echo "<a href=\"$_SERVER[PHP_SELF]?index=".$i."\">[$i]</a>&nbsp;\n";
        }
    }
    if ($page < $totalpage-1) {
        echo "<a href=\"$_SERVER[PHP_SELF]?index=".($page+1)."\">[Next]</a>\n";
    }
?>
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Tue Feb 13, 2007 7:36 am    Post subject: Reply with quote

can any one help me with this script ?
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Wed Feb 14, 2007 11:11 am    Post subject: Reply with quote

any one ?
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Wed Feb 14, 2007 1:36 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
pkSML
-


Joined: 29 May 2006
Posts: 952
Location: Michigan, USA

PostPosted: Wed Feb 14, 2007 2:47 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Override
-


Joined: 25 Nov 2003
Posts: 124
Location: Virtual Abyss N Area 61

PostPosted: Thu Feb 15, 2007 10:20 am    Post subject: Reply with quote

ty
Back to top View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group