Ticket #2379 (new patch)
Attempt in getting sublevel URLs working in the URLSegment field for blog
| Reported by: | sharvey | Owned by: | sminnee |
|---|---|---|---|
| Priority: | medium | Milestone: | |
| Component: | Sapphire Framework | Version: | 2.2.2-rc2 |
| Severity: | high effort / impact | Keywords: | notformerge |
| Cc: | Hours: |
Description (last modified by sharvey) (diff)
I tried to get blog posts under a sublevel url like blog/my-entry
There's problems with trying to get the URLSegment to save as "blog/my-entry" instead of "my-entry" - I got it to a point in the patch where it saved as "blog/blog-my-entry", but at that point I realised I was just hacking my way through a forest of core code, an almost futile effort.
Getting the page to display as well, is a major headache, because "blog/my-entry" takes you to the BlogHolder? page, and requires you to find the "BlogEntry?" record by it's URLSegment in the controller, in an attempt to spit out the blog entry by the URL. So, something like DataObject::get('BlogEntry?', "URLSegment = 'Director::urlParam(Action)'") - this is all good and fine, but there's a str_replace on Director, line 163:
$argumentsAction? = str_replace('-',,$argumentsAction?);
This means you can't get the record, because the URLSegment has been modified to show as "myentry" (slashes removed) from Director::urlParams().
This ticket isn't to fix something, but to provide a point where I failed, so in the future people can figure out how to do it right!
