I strongly oppose that approach. The slug of a post should be globally unique — and it shouldn't include the tree. If we're going to do that, we might as well use the "permalink" as the slug.
If I change where a post is located, it should not change the slug. The hierarchy of a post should no more define a post as the date or title do, both of which can change without changing the slug. I'm not sure why we are even explicitly forcing the parents. Instead, I think we should just take the last url part and assume that's the slug you're requesting. It'll give the full appearance of subpages, but without complication. On May 9, 2009, at 11:48 PM, Michael Harris wrote: > > 2009/5/8 Owen Winkler <[email protected]>: >> >> Michael Harris wrote: >>> I'm hoping for advice as to the best way to achieve sub-page >>> rewrites. >>> I have little clue about rewrite rules. >> >> In rewriterules.php: >> >> array( 'name' => 'display_page', 'parse_regex' => >> '%^(?P<parentage>.*/)(?P<slug>[^/]+)(?:/page/(?P<page>\d+))?/?$%i', >> 'build_str' => '{$slug}(/page/{$page})', 'handler' => >> 'UserThemeHandler', 'action' => 'display_post', 'priority' => 100, >> 'description' => 'Return page matching specified slug', >> 'parameters' => >> serialize( array( 'require_match' => array('Posts', >> 'rewrite_match_type'), 'content_type'=>'page' ) ) ), >> >> >> Note the addition of the <parentage> capture. >> >> You'd need to change the require_match parameter to point to a >> function >> that would validate that the post with the requested slug is the type >> (page) required, and also that the value of parentage matches any >> needed >> parent slug values. >> >> It might be more efficient to alter the Posts table slug field (and >> the >> code that supports it) to include the full URL, including the >> slashes. > > That almost makes sense to me. I'll give it a go and see what I come > up with. Thank you. > > > > -- > Michael C. Harris, School of CS&IT, RMIT University > http://twofishcreative.com/michael/blog > IRC: michaeltwofish #habari > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev -~----------~----~----~----~------~----~------~--~---
