Page 1 of 1

continuing work on vanity URLs - next and previous links

Posted: Fri Feb 12, 2010 5:09 pm
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

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

Posted: Fri Feb 12, 2010 6:51 pm
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

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

Posted: Fri Feb 12, 2010 9:29 pm
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

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

Posted: Sat Feb 13, 2010 12:09 am
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/.