PyroCMS v0.9.7.4 - an open-source modular general purpose CMS |
[eluser]Turv[/eluser]
[quote author="Phil Sturgeon" date="1251226630"]OK scratch that, I was close but not entirely. The magic query we need to use is this: Quote:SELECT p3.* This will support everything we need from it. It will pick the correct tree and make sure even if there are two "child" or "grandchild" slugs anywhere else it will still take the right path. I have roughed up some code (not tested). Code: // Work out how many segments there are Something like that should do. Sudden inspiration! :lol:[/quote] Fantastic! Got it working! This is now my getBySlug function Code: public function getBySlug($slug = '', $lang = NULL) There is one problem with this code it seems, and it's the From clause. This is the output query of the above (using my test) Code: SELECT p3.* This produced 10 results apparently, Hence the limit clause. However changing the from clause to this makes it work perfectly. Note: The only difference is the from clause is 'FROM pages as p1' where as CI produces FROM (pages AS p1, pages). Why is it doing that, and can we make it produce what we want? Code: SELECT p3.* Great job bud, I would have never thought about doing that. |
Welcome Guest, Not a member yet? Register Sign In |