Subcategories in URL?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
mo
Regular
Posts: 40
Joined: Sun Jan 27, 2008 11:33 pm
Contact:

Subcategories in URL?

Post by mo »

How can I achieve that subcategories contain their parent categories in their permalink URL?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Subcategories in URL?

Post by garvinhicking »

Hi!

Only by hacking the core code of Serendipity, there currently is no support for this.

You would need to patch the include/functions_permalinks.inc.php file and there patch those functions:

*serendipity_makePermalink: Add a new option like %parentcategories% into the regexp pattern, and for the "category" case add output to the $replacements array where you fetch all parent categories to a selected category. There currently is no function to fetch all involved parents, so the SQL for that would need to be written as well.

* serendipity_makePErmalinkRegex: Also add the new %parentcategories% pattern here.


Well....since you asked for it, I just committed it to the s9y repository:

http://svn.berlios.de/viewcvs/serendipi ... ision=2384

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/
mo
Regular
Posts: 40
Joined: Sun Jan 27, 2008 11:33 pm
Contact:

Post by mo »

Now that is wonderful :) Thanks! I'll try the new code as soon as I find the time later this week.
mo
Regular
Posts: 40
Joined: Sun Jan 27, 2008 11:33 pm
Contact:

Post by mo »

Works perfectly! Thanks again.
Post Reply