Gossamer Forum
Quote Reply
next/prev global
Hi,

I need a global that converts a dynamic url (next_url and prev_url) to static

Example:

http://domain.com/page.cgi?g=Detailed/19382.html&d=1

to

http://domain.com/news/Detailed/19382.html


Any suggestions?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
I guess you could do something like:

Code:
sub {
my $url = $IN->url({ query_string => 1 });
my ($id) = $url =~ m|g=Detailed/(\d+)\.html|i;
return "$CFG->{build_detail_url}/$1.html";
}

Untested.
Quote Reply
Re: [Paul] next/prev global In reply to
Almost - I got:
http://domain.com/news/Detailed/.html

the ID was killed...

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
Oops I'm dumb.

Change $1 to $id
Quote Reply
Re: [Paul] next/prev global In reply to
yeah I got it just after I sent the message - I'm the dumb one....

Thanks

Klaus

http://www.ameinfo.com
Quote Reply
Re: [Paul] next/prev global In reply to
Nope - still not returning the ID..??

Code:
sub {
my $url = $IN->url({ query_string => 1 });
my ($id) = $url =~ m|g=Detailed/(\d+)\.html|i;
return "$CFG->{build_detail_url}/$id.html"; }

Any suggestions?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
Can you try printing the value of $url to see what it contains.

Last edited by:

Paul: Apr 11, 2003, 9:29 AM
Quote Reply
Re: [Paul] next/prev global In reply to
I tried using return $url; and got error - can't compile

I use it as <%rewrite_nav($next_url%> - and when I make a template dump I get the url I gave at the first post..?

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
Try changing the first line to:

my $url = shift;

I didn't realise you were passing in a URL.
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
Did you try this?
<%rewrite_nav($next_url)%>

) was missing

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [Paul] next/prev global In reply to
My bad - sorry I should have mentioned that from the start... it works now - Thanks

Klaus

http://www.ameinfo.com
Quote Reply
Re: [webmaster33] next/prev global In reply to
Yes I did use the ) - just a typo in the forum - but well spotted :-)

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
Are you saying it's possible within a detailed page to have a link to previous and next detailed page?? I'd love this. Thanks!
Quote Reply
Re: [dwh] next/prev global In reply to
Hi,

Yes that is what this global does - next / previous detailed page in the current category

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
Doesn't work for me. I'm not too handy w/ this global business. I don't even know what to name the global, dummy me!

What I'd love is for each detailed html page to have a link to previous and next detailed page...preferably global rather than within a category but I'll settle for what I can get.

It looks like in this case you need to have a dynamic url for it to work? So the built pages won't have it?
Quote Reply
Re: [dwh] next/prev global In reply to
Hi,

No it should work with static pages too (although you will not have the latest added links until you build)

1. Make a new global - name it ex. nextprev
2. On your detailed pages insert <%nextprev%> at the top of the page
3. Insert a <%next_url%> and <%prev_url%> on the detailed page

THat should do it

Klaus

http://www.ameinfo.com
Quote Reply
Re: [klauslovgreen] next/prev global In reply to
OK, but I'm confused. Where does <%next_url%> <%prev_url%> get set in the code above?

Also, I was getting Detailed/.html even though I used this code:




sub {
my $url = shift;
my $url = $IN->url({ query_string => 1 });
my ($id) = $url =~ m|g=Detailed/(\d+)\.html|i;
return "$CFG->{build_detail_url}/$id.html";
}
Quote Reply
Re: [dwh] next/prev global In reply to
Quote:
OK, but I'm confused. Where does <%next_url%> <%prev_url%> get set in the code above?

You need to insert that where you want the links to next/previous detailed pages - on your detailed.html template

Quote:
Detailed/.html
? what do you mean?

http://www.ameinfo.com