PyroCMS v0.9.7.4 - an open-source modular general purpose CMS |
[eluser]Phil Sturgeon[/eluser]
Sweet, glad my code was helpful! The problem is that getBySlug() currently just sets up the db clauses then runs through $this->get() to grab the content. This whole model looks bloody disgusting and really needs some cleaning! A few things here. I would take out the AS commands, they are not needed and might screw with things a bit. It is not a LEFT join, as neither side is any more likely to exit. It is closest to being an outter join, but the WHERE clause will destroy it anyway, so leave the 3rd param in the join blank. We should change this model now as there is no longer any need to ever get a page by a slug. It will always be edited, viewed or referenced by an ID or the uri segments. Here is a suggestion of how the model should probably look now. This replaces getById(), getBySlug() and get() with a modified getById() and a renamed function getByURL(). get() is deleted. You might also notice me being picky with your syntax. It is partially me being anal and partially me wanting to keep the CMS using the same sytax all over. camelCase for functions, underscores for variables, allman for structures. Other than that, good work dude! :-) |
Welcome Guest, Not a member yet? Register Sign In |