My first instinct is to go with a custom pages controller. I'm doing something similar right now with custom SEO paths in a site, and just jumping over Cake's pages routing entirely was the easiest way forward.
- James On Jun 4, 6:11 pm, [EMAIL PROTECTED] wrote: > Hi All, > > Over the course of last year I rebuilt my employer's website from > scratch using CakePHP. It is a site for a futures trading firm with > lots of interesting tools for sorting and combining data that were > remarkably fun and easy to build with CakePHP. I'm now a total convert > to the cult of Cake. > > Fast forward to last December, when I left that job for a job at a > university. I'm now in charge of my school's CMS, which houses about > 30 "sites" and was built over the course of 5 or 6 years by a > succession of undergrad work study students. It works OK, but is ugly > and inflexible and kludgy and every day that I have to work with it it > steals another piece of my soul. So I'm going to embark on a rewrite > in CakePHP. > > Here is my problem though: I don't want to impact my users' sites, > meaning I want to keep their URLs intact and continue to use the same > underlying database containing sites and pages (where a record in the > "page" table has a URI, a parent id/URI, page content, an optional > controller and template, and lots of other fields. Since the site page > hierarchies can be arbitrarily complex, the URLs can be very long and > don't fit the usual /controller/action/param1/param2 convention that's > easy to work with in CakePHP. > > Instead, the URLs would be something like > this:http://www.school.university.edu/program/about/people/faculty > > Where the "faculty" page could have some static content at the top -- > static in the sense that it lives in a database and can be edited by a > CMS editor -- and then a custom controller that looks in a separate > table for a list of faculty at that program and assigns them to the > template. > > So the main issue I'm facing is, how to map that /program/about/people/ > faculty URI to the "faculty" page which is a child of the "people" > page which is a child of the "about" page which is a child of the > "program" page. I'm not looking for specific code here, just some > general approaches. The two obvious approaches that I could see are: > > 1. map everything to a custom pages controller that figures out which > page to display, and then decides if there is a custom controller/ > action to call and then calls it > 2. in routes.php, figure out the specific page being asked for by > splitting up the URI path and recursively working through the > database, and then if that page has a controller/action pair call it > and if not call the pages_controller; and in app_controller always get > the content for the specific page record. The question here would be > -- how to have routes.php pass the page ID to app_controller? > > Assuming I had a model for the Pages table, are there any Model > methods I could use to figure out the page ID given the URL path? > (findAllThreaded() maybe? just now sure how exactly I'd use it here) > > Any input would be most appreciated. > > Thanks, > Matthew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. 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/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
