I would like to use urls of the form www.example.com/section/subsection/page/ where 'section' is the parent of 'subsection' which is the parent of 'page' in the CMS content hierarchy (and each are pages in their own right). I would also like any link to the 'default' page to simply link to www.example.com/ (instead of www.example.com/home/ or whatever).
I think I can do this quite easily by editing the source and .htaccess files but I was wondering why there are several versions of the GetURL() function that seem to be doing exactly the same thing - notably in lib/page.functions.php and lib/contenttypes/Content.inc.php. Wouldn't it make more sense to have a single function to generate all URLs or maybe an overridable class method on each content type?
Of course configurable custom URL generation would rock my pants off but I understand that's a bit more tricky.
The other note is that in the scheme outlined above every page and section would need to have a globally unique alias. It would be nice to be able to use the parent section alias(es) as part of each page alias in order to allow locally unique aliases. E.g. www.example.com/dept1/contact/ and www.example.com/dept2/contact/
hierarchical URLs
Re: hierarchical URLs
(sorry, I meant to reply back to this 2 days and forgot)
I really like this idea. I've actually been contemplating it, but I didn't know what kind of havoc it would cause on image paths, etc. I'd be all for trying it as a post 1.0 change. Making a note in Trac as we speak...
Oh, and with GetURL, the one in page.functions.php is old cruft. All of the content types generate their own URLs now. What would probably be a good idea is to have GetURL() do something in the base class (lib/classes/class.content.inc.php) and then just override it in the Link content type, since that's the only one doing something out of the ordinary.
I really like this idea. I've actually been contemplating it, but I didn't know what kind of havoc it would cause on image paths, etc. I'd be all for trying it as a post 1.0 change. Making a note in Trac as we speak...
Oh, and with GetURL, the one in page.functions.php is old cruft. All of the content types generate their own URLs now. What would probably be a good idea is to have GetURL() do something in the base class (lib/classes/class.content.inc.php) and then just override it in the Link content type, since that's the only one doing something out of the ordinary.
Re: hierarchical URLs
Cool, I'll have a stab at modifying GetURL. Image paths should be OK as long as we're careful with the rewrite rules. I'll post back if I come across anything exciting 

Re: hierarchical URLs
At present I've got a solution that does exactly what you suggest. It involves a chunk of mod_rewrite code and then simply naming your page aliases appropriately.
e.g. the alias name is home/about us and the url is then cleaned of its index.php?id= bit.
It's not ideal but it works. You'll find the thread and solution in the forums by searching on 'clean urls' I believe.
If you come up with an internal solution please post here.
e.g. the alias name is home/about us and the url is then cleaned of its index.php?id= bit.
It's not ideal but it works. You'll find the thread and solution in the forums by searching on 'clean urls' I believe.
If you come up with an internal solution please post here.
Re: hierarchical URLs
I did this on one of my sites. You can view the code here:
http://jellybean.uni.cc/_source/index.php (note: for security reasons you can't read all the included files)
Basically what I did was have mod_rewrite send everything to index.php. Then index.php would at the url the person requested. If it was a file that existed then the PHP would just pass it on. Otherwise it would see if my cms thing had any pages that would fit. If it couldn't find anything it would 404. My implementation still needs a bit of work, but you get the idea.
http://jellybean.uni.cc/_source/index.php (note: for security reasons you can't read all the included files)
Basically what I did was have mod_rewrite send everything to index.php. Then index.php would at the url the person requested. If it was a file that existed then the PHP would just pass it on. Otherwise it would see if my cms thing had any pages that would fit. If it couldn't find anything it would 404. My implementation still needs a bit of work, but you get the idea.
Re: hierarchical URLs
That sounds cool.
I think it would be interesting to add that as an option for CMS configuration.
I think it would be interesting to add that as an option for CMS configuration.
Many modules available from the http://dev.cmsmadesimple.org
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
The CMS Made Simple Developer Cookbook is now available from Packt Publishers!
Re: hierarchical URLs
I could be wrong but it seems there's a module in SVN which claims to do just this. It just hasn't been advertised yet. Can anyone confirm that?
I'm afraid to use anything from the SVN. It's scary enough just browsing. :
I'm afraid to use anything from the SVN. It's scary enough just browsing. :