17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1470 Views |
-
urlParams from within DataObject

12 October 2007 at 10:50am
Hi guys,
I used to have a function Current() on my Category-class (extends DataObject):
function Current()
{
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?function Current()
{
if(????->urlParams['ID'] == $this->Title) return " class='current'";
}Any ideas?
(That's not the main function that uses the urlparams, but the other functions are on the pagecontrollers..) -
Re: urlParams from within DataObject

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
or
Director::urlParam('the one you want')
| 1470 Views | ||
|
Page:
1
|
Go to Top |

