What do you want to achieve?
$currentDir[2] == first parameter for your method if I am guessing
correctly. Why create a global array for something that is accessible
(in a much easier form) anyway? Reffering to $currentDir would break if
you accessed your method via a route with a different number of
'folders', or moved your application to a subfolder.
That code looks like
ListingsController extends AppController {
function index ($type=null) {
$today = ...;
$nW = ...;
$conditions = array('Ltype.Date>=$today",'Listing.Date'=>"<$nW");
if ($type){
$conditions['Ltype.Name']=>$type;
}
$fields = array('Ltype.name', 'Listing.name',
'Listing.date','Venue.name');
...
}
}
If you want to access the equivalent of $currentDir[2] in your
beforeFilter, or somewhere else generic, you could use
$this->params['pass'][0] to refer to the parameter.
>Is it worth making $currentDir a global array?
I would say no.
HTH,
AD7six
PS. Code not tested, but should be about right.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---