17488 Posts in 4473 Topics by 1978 members
|Go to End|
12 October 2007 at 10:50am
I used to have a function Current() on my Category-class (extends DataObject):
if($_GET['Title'] == $this->Title) return " class='current'";
Now I rewrote some stuff so I don't have to use $_GET anymore, but use urlParams instead.
But the problem is, how do I call it from within my dataobject?
if(????->urlParams['ID'] == $this->Title) return " class='current'";
(That's not the main function that uses the urlparams, but the other functions are on the pagecontrollers..)
12 October 2007 at 11:27am
Fixed, thanks to MattSS.
Quite easy actually: when you're in a model instead of a controller you can access urlParams by
Director::urlParams() -> this gives an array of all them
Director::urlParam('the one you want')
|Go to Top|