/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
simple navigation
Fra : Zombie Commando [rai~


Dato : 08-06-01 19:05

Hi,
Here's a small but efficient feature I want to add in my template generated
php site.
I would like to add simple "previous" and "next" links in certain content
pages.

Since my URLs are generated like so:
www.site.com/template.php?content=news ,
Is it possible to for a script to read the "content" variable and verify if
there is a number following it?

This way the "next" link in the content file would know that if the URL is
www.site.com/template.php?content=news1 , then it will go to:
www.site.com/template.php?content=news2 when clicked on.

If www.site.com/template.php?content=news3 doesnt exist, it would simply go
back to:
www.site.com/template.php?content=news1

Of course, if there is no number in the value of "content", this wont work.
I would only put the next and prvious links in numbered pages anyway.

Is this clear?
Can anyone help?


-steph
www.raisinlove.com

"Well its simple, AJ. We're cool and you're not. You should just feel lucky
that we're not pounding your ass by the bike racks after school." - Marian
Try Slaughter on AJ Razor

rezinluv @ gashed.com
webmaster @ mutemag.com
webmaster @ drawnandquarterly.com



 
 
Reggie (08-06-2001)
Kommentar
Fra : Reggie


Dato : 08-06-01 19:25

This tutorial at webmonkey seems to be exactly what you are looking for

http://hotwired.lycos.com/webmonkey/99/25/index2a.html?tw=programming

Reggie


"Zombie Commando [raisinlove]" <steph-at-raisinlove-dot-com@spam.com> wrote
in message news:9fr3s0$5fs6j$1@ID-75711.news.dfncis.de...
> Hi,
> Here's a small but efficient feature I want to add in my template
generated
> php site.
> I would like to add simple "previous" and "next" links in certain content
> pages.
>
> Since my URLs are generated like so:
> www.site.com/template.php?content=news ,
> Is it possible to for a script to read the "content" variable and verify
if
> there is a number following it?
>
> This way the "next" link in the content file would know that if the URL is
> www.site.com/template.php?content=news1 , then it will go to:
> www.site.com/template.php?content=news2 when clicked on.
>
> If www.site.com/template.php?content=news3 doesnt exist, it would simply
go
> back to:
> www.site.com/template.php?content=news1
>
> Of course, if there is no number in the value of "content", this wont
work.
> I would only put the next and prvious links in numbered pages anyway.
>
> Is this clear?
> Can anyone help?
>
>
> -steph
> www.raisinlove.com
>
> "Well its simple, AJ. We're cool and you're not. You should just feel
lucky
> that we're not pounding your ass by the bike racks after school." - Marian
> Try Slaughter on AJ Razor
>
> rezinluv @ gashed.com
> webmaster @ mutemag.com
> webmaster @ drawnandquarterly.com
>
>



Justin Koivisto (08-06-2001)
Kommentar
Fra : Justin Koivisto


Dato : 08-06-01 19:26

"Zombie Commando [raisinlove]" wrote:
>
> Hi,
> Here's a small but efficient feature I want to add in my template generated
> php site.
> I would like to add simple "previous" and "next" links in certain content
> pages.
>
> Since my URLs are generated like so:
> www.site.com/template.php?content=news ,
> Is it possible to for a script to read the "content" variable and verify if
> there is a number following it?
>
> This way the "next" link in the content file would know that if the URL is
> www.site.com/template.php?content=news1 , then it will go to:
> www.site.com/template.php?content=news2 when clicked on.
>
> If www.site.com/template.php?content=news3 doesnt exist, it would simply go
> back to:
> www.site.com/template.php?content=news1
>
> Of course, if there is no number in the value of "content", this wont work.
> I would only put the next and prvious links in numbered pages anyway.
>
> Is this clear?
> Can anyone help?
>
> -steph
> www.raisinlove.com
>
> "Well its simple, AJ. We're cool and you're not. You should just feel lucky
> that we're not pounding your ass by the bike racks after school." - Marian
> Try Slaughter on AJ Razor
>
> rezinluv @ gashed.com
> webmaster @ mutemag.com
> webmaster @ drawnandquarterly.com

$number=substr($content,strlen($content)-1);

This grabs the last character from the string. However, if you have
numbers that are more digits, you could either use a regex type of
statement, or format all the numbers equally. For instance if you think
that you may get to 999 for the back next (doubtful), you could format
all the numbers with 3 digits. Then you'd have news001, news002, etc and
use the above with -3 instead of -1

Søg
Reklame
Statistik
Spørgsmål : 177523
Tips : 31968
Nyheder : 719565
Indlæg : 6408674
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste