[eluser]Unknown[/eluser]
In my view, I am trying to keep things simple by writing some functions to do some common things.
I have something like this, where $viewdata[sortcurrent] is passed from my controller:
Code:
function sorted_by( $sortnumber, $displaytext ) {
if ( $sortnumber == $sortcurrent ) {
...
}
}
Even if I add global $sortcurrent, I still can't seem to access that variable from the function contained in my view. (It isn't exactly a global, but it is local in scope.)
To work around this, I ended up using:
Code:
function sorted_by( $sortnumber, $displaytext, $sortcurrent )
and everywhere sorted_by is called, I pass in $sortcurrent. This works, but is there a better or easier way to access the $sortcurrent from inside a function?