Re: define() and app_controller

2008-02-22 Thread Dardo Sordi Bogado

In AppController beforeFilter() would be a good place.

On Thu, Feb 21, 2008 at 11:26 PM, jason m [EMAIL PROTECTED] wrote:

  I have a method that runs a bunch of define statements for
  localizations stored in a database.

 function loadAll($language = 'english',$group=null){
 $localizations = $this-Localization-findAll(,array('name',
  $language));
 foreach($localizations as $localization){
 define({$localization['Localization']
  ['name']},{$localization['Localization'][$language]});
 }
 }

  I want this to run on every page that loads but I am having trouble
  with where to call the method from. Calling it from a page works like
  from index.ctp $this-requestAction('localizations/loadAll/japanese').
  However, I don't want to do that on every page. I tried making an
  app_controller.php in the app folder and using the beforeRender
  function but that didn't work. I also tried the requestAction from the
  default layout and that also didn't work. Please tell me what the best
  practice is for doing this.

  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



define() and app_controller

2008-02-21 Thread jason m

I have a method that runs a bunch of define statements for
localizations stored in a database.

function loadAll($language = 'english',$group=null){
$localizations = $this-Localization-findAll(,array('name',
$language));
foreach($localizations as $localization){
define({$localization['Localization']
['name']},{$localization['Localization'][$language]});
}
}

I want this to run on every page that loads but I am having trouble
with where to call the method from. Calling it from a page works like
from index.ctp $this-requestAction('localizations/loadAll/japanese').
However, I don't want to do that on every page. I tried making an
app_controller.php in the app folder and using the beforeRender
function but that didn't work. I also tried the requestAction from the
default layout and that also didn't work. Please tell me what the best
practice is for doing this.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---