Page 1 of 1

Subcategories in URL?

Posted: Wed Nov 26, 2008 12:43 am
by mo
How can I achieve that subcategories contain their parent categories in their permalink URL?

Re: Subcategories in URL?

Posted: Wed Nov 26, 2008 1:33 pm
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

Posted: Wed Nov 26, 2008 5:17 pm
by mo
Now that is wonderful :) Thanks! I'll try the new code as soon as I find the time later this week.

Posted: Mon Dec 01, 2008 11:21 am
by mo
Works perfectly! Thanks again.