continuing work on vanity URLs - next and previous links

Creating and modifying plugins.
Post Reply
perlnerd
Regular
Posts: 37
Joined: Mon Mar 27, 2006 11:02 pm

continuing work on vanity URLs - next and previous links

Post by perlnerd »

I'm back after a break and working on my Vanity URL plugin.

I have the plugin working so that http://www.example.com/blog/clintg displays the users posts. The issue I have now is that the next and previous page URLs are broken.

I end up with a URL like http://www.example.com/blog/clintg/P2.html

How can I change the next and previous links? So I get a proper URL like: http://example.com/blog/authors/5-clintg/P2.html

From looking through the source code it appears that (for the example above) I need to somehow populate $serendipity['uriArguments'] with the values 'authors', and '5-clintg' so that serendipity_printEntryFooter() can generate the proper links to next and previous pages. I try to set them in my plugin but it doesn't seem to have any effect (maybe overwritten later?).

Thanks
Clint
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: continuing work on vanity URLs - next and previous links

Post by garvinhicking »

Hi!

The next/prev links are built based on $serendipity['uriArguments'] which in turn is based on $_SERVER['REQUEST_URI']. So you might want to modify either of those within the serendipity 'frontend_configure' event hook with an event plugin.

HTH,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
perlnerd
Regular
Posts: 37
Joined: Mon Mar 27, 2006 11:02 pm

Re: continuing work on vanity URLs - next and previous links

Post by perlnerd »

Thanks Garvin!

That did the trick. Thanks for the nudge in the right direction.

Code: Select all

 $_SERVER['REQUEST_URI'] = $serendipity['serendipityHTTPPath'] . "authors/" . $authorInfo[0]['authorid'] . "-" . $authorInfo[0]['username'];
Now to figure out how to gracefully fail when some one uses a nonexistent username.

Clint
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: continuing work on vanity URLs - next and previous links

Post by Don Chambers »

Not sure if this matters to you, but the path to authors/ is a configuration value.... it could be changed to anything, ie writers/.
=Don=
Post Reply