Re: Undefined variable: ... CORE\app\views\layouts\default.ctp
1) Constants should be defined in app/config/bootstrap.php, not in the controller class 2) debug the view variables, if defined in app_controller that variable should be available to views, also check that you don't unset it. On Nov 22, 2007 8:48 AM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > Hi, > I meet 2 issue : > > A) Constantes > B) Array and undefined index > > A) Constantes > When i define a constante in the __construct of the app_controller.php > cakephp try to define it twice ... > > one for each controllor ? (app_controller.php and one for > [myapp]_controller.php ) ? > > if so ; do i have to define my constantes in bootstrap.php instead ? > > B) Undefined index > > when i instanciate my $foxtal in __construct of the my > app_controller.php > > class AppController extends Controller { > >public function __construct() { >$foxtal = & new foxtal(); >$this->set('foxtal', $foxtal); >} > } > > and access to http://localhost/ and do > in the layout > everything goes well > > BUT as soon as i do http://localhost/article/index > > the same echo in my the view give a NOTICE undefined index ... > > Why ? > Kind Regards > > On 21 nov, 13:54, FoxMaSk <[EMAIL PROTECTED]> wrote: > > Thanks you very much ! > > i'm starting to see how to rethink a complet CMS which did not use > > MVC ; its a real pain, but that's come slowly ;) > > > > On 21 nov, 13:17, Repsah <[EMAIL PROTECTED]> wrote: > > > > > because you have to put that declaration in the constructor, not in an > > > index() method that you probably won't call. > > > > > On Nov 21, 2007 1:09 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > > i tried : > > > > class AppController extends Controller { > > > > > >public function index() { > > > >$foxtal = & new foxtal(); > > > >$this->set('foxtal', $foxtal); > > > >} > > > > } > > > > > > and then in default.ctp i still have : > > > > > > > > > > > echo "foobar"; > > > > print_r($foxtal); ?> > > > > > > > > which give the error Undefined variable: foxtal > > > > > > where is the mistake ? > > > > Kind Regards. > > > > > > On 21 nov, 12:29, Repsah <[EMAIL PROTECTED]> wrote: > > > > > Inizialize the class in your app_controller and export it to views > using > > > > the > > > > > set() method. > > > > > > > On Nov 21, 2007 12:18 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi, > > > > > > in the boostrap.php i call a vendor script that does a lot of > stuff > > > > > > > > one of them is to get the punbb (a BB sofware) config > > > > > > > > class foxtal > > > > > > { > > > > > > public $pun_config; > > > > > > { > > > > > > public function __construct() > > > > > ># Load cached config > > > > > >if > (file_exists(PUN_ROOT.'/cache/cache_config.php')) > > > > > >require > PUN_ROOT.'/cache/cache_config.php'; > > > > > > > >if (!defined('PUN_CONFIG_LOADED') && $this- > > > > > > >_generate_config_cache()) > > > > > >require > PUN_ROOT.'/cache/cache_config.php'; > > > > > > > >$this->pun_config =& $pun_config; > > > > > > } > > > > > > [...] > > > > > > } > > > > > > > > so i do $foxtal = & new foxtal(); > > > > > > > > now in the layout and everywhere in my application i'd like to > be able > > > > > > to do use $foxtal > > > > > > for example : echo $foxtal['o_cur_version'] in the defailt.ctpfile > > > > > > > > Is it possible ? > > > > > > > > What do i need to do ? > > > > > > > > Kind Regards. > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Undefined variable: ... CORE\app\views\layouts\default.ctp
Hi, I meet 2 issue : A) Constantes B) Array and undefined index A) Constantes When i define a constante in the __construct of the app_controller.php cakephp try to define it twice ... one for each controllor ? (app_controller.php and one for [myapp]_controller.php ) ? if so ; do i have to define my constantes in bootstrap.php instead ? B) Undefined index when i instanciate my $foxtal in __construct of the my app_controller.php class AppController extends Controller { public function __construct() { $foxtal = & new foxtal(); $this->set('foxtal', $foxtal); } } and access to http://localhost/ and do in the layout everything goes well BUT as soon as i do http://localhost/article/index the same echo in my the view give a NOTICE undefined index ... Why ? Kind Regards On 21 nov, 13:54, FoxMaSk <[EMAIL PROTECTED]> wrote: > Thanks you very much ! > i'm starting to see how to rethink a complet CMS which did not use > MVC ; its a real pain, but that's come slowly ;) > > On 21 nov, 13:17, Repsah <[EMAIL PROTECTED]> wrote: > > > because you have to put that declaration in the constructor, not in an > > index() method that you probably won't call. > > > On Nov 21, 2007 1:09 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > i tried : > > > class AppController extends Controller { > > > >public function index() { > > >$foxtal = & new foxtal(); > > >$this->set('foxtal', $foxtal); > > >} > > > } > > > > and then in default.ctp i still have : > > > > > > > > echo "foobar"; > > > print_r($foxtal); ?> > > > > > > which give the error Undefined variable: foxtal > > > > where is the mistake ? > > > Kind Regards. > > > > On 21 nov, 12:29, Repsah <[EMAIL PROTECTED]> wrote: > > > > Inizialize the class in your app_controller and export it to views using > > > the > > > > set() method. > > > > > On Nov 21, 2007 12:18 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > > Hi, > > > > > in the boostrap.php i call a vendor script that does a lot of stuff > > > > > > one of them is to get the punbb (a BB sofware) config > > > > > > class foxtal > > > > > { > > > > > public $pun_config; > > > > > { > > > > > public function __construct() > > > > ># Load cached config > > > > >if (file_exists(PUN_ROOT.'/cache/cache_config.php')) > > > > >require PUN_ROOT.'/cache/cache_config.php'; > > > > > >if (!defined('PUN_CONFIG_LOADED') && $this- > > > > > >_generate_config_cache()) > > > > >require PUN_ROOT.'/cache/cache_config.php'; > > > > > >$this->pun_config =& $pun_config; > > > > > } > > > > > [...] > > > > > } > > > > > > so i do $foxtal = & new foxtal(); > > > > > > now in the layout and everywhere in my application i'd like to be able > > > > > to do use $foxtal > > > > > for example : echo $foxtal['o_cur_version'] in the defailt.ctp file > > > > > > Is it possible ? > > > > > > What do i need to do ? > > > > > > Kind Regards. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Undefined variable: ... CORE\app\views\layouts\default.ctp
Thanks you very much ! i'm starting to see how to rethink a complet CMS which did not use MVC ; its a real pain, but that's come slowly ;) On 21 nov, 13:17, Repsah <[EMAIL PROTECTED]> wrote: > because you have to put that declaration in the constructor, not in an > index() method that you probably won't call. > > On Nov 21, 2007 1:09 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > i tried : > > class AppController extends Controller { > > >public function index() { > >$foxtal = & new foxtal(); > >$this->set('foxtal', $foxtal); > >} > > } > > > and then in default.ctp i still have : > > > > > echo "foobar"; > > print_r($foxtal); ?> > > > > which give the error Undefined variable: foxtal > > > where is the mistake ? > > Kind Regards. > > > On 21 nov, 12:29, Repsah <[EMAIL PROTECTED]> wrote: > > > Inizialize the class in your app_controller and export it to views using > > the > > > set() method. > > > > On Nov 21, 2007 12:18 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > in the boostrap.php i call a vendor script that does a lot of stuff > > > > > one of them is to get the punbb (a BB sofware) config > > > > > class foxtal > > > > { > > > > public $pun_config; > > > > { > > > > public function __construct() > > > ># Load cached config > > > >if (file_exists(PUN_ROOT.'/cache/cache_config.php')) > > > >require PUN_ROOT.'/cache/cache_config.php'; > > > > >if (!defined('PUN_CONFIG_LOADED') && $this- > > > > >_generate_config_cache()) > > > >require PUN_ROOT.'/cache/cache_config.php'; > > > > >$this->pun_config =& $pun_config; > > > > } > > > > [...] > > > > } > > > > > so i do $foxtal = & new foxtal(); > > > > > now in the layout and everywhere in my application i'd like to be able > > > > to do use $foxtal > > > > for example : echo $foxtal['o_cur_version'] in the defailt.ctp file > > > > > Is it possible ? > > > > > What do i need to do ? > > > > > Kind Regards. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Undefined variable: ... CORE\app\views\layouts\default.ctp
because you have to put that declaration in the constructor, not in an index() method that you probably won't call. On Nov 21, 2007 1:09 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > i tried : > class AppController extends Controller { > >public function index() { >$foxtal = & new foxtal(); >$this->set('foxtal', $foxtal); >} > } > > and then in default.ctp i still have : > > echo "foobar"; > print_r($foxtal); ?> > > which give the error Undefined variable: foxtal > > where is the mistake ? > Kind Regards. > > > On 21 nov, 12:29, Repsah <[EMAIL PROTECTED]> wrote: > > Inizialize the class in your app_controller and export it to views using > the > > set() method. > > > > On Nov 21, 2007 12:18 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi, > > > in the boostrap.php i call a vendor script that does a lot of stuff > > > > > one of them is to get the punbb (a BB sofware) config > > > > > class foxtal > > > { > > > public $pun_config; > > > { > > > public function __construct() > > ># Load cached config > > >if (file_exists(PUN_ROOT.'/cache/cache_config.php')) > > >require PUN_ROOT.'/cache/cache_config.php'; > > > > >if (!defined('PUN_CONFIG_LOADED') && $this- > > > >_generate_config_cache()) > > >require PUN_ROOT.'/cache/cache_config.php'; > > > > >$this->pun_config =& $pun_config; > > > } > > > [...] > > > } > > > > > so i do $foxtal = & new foxtal(); > > > > > now in the layout and everywhere in my application i'd like to be able > > > to do use $foxtal > > > for example : echo $foxtal['o_cur_version'] in the defailt.ctp file > > > > > Is it possible ? > > > > > What do i need to do ? > > > > > Kind Regards. > > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Undefined variable: ... CORE\app\views\layouts\default.ctp
i tried : class AppController extends Controller { public function index() { $foxtal = & new foxtal(); $this->set('foxtal', $foxtal); } } and then in default.ctp i still have : which give the error Undefined variable: foxtal where is the mistake ? Kind Regards. On 21 nov, 12:29, Repsah <[EMAIL PROTECTED]> wrote: > Inizialize the class in your app_controller and export it to views using the > set() method. > > On Nov 21, 2007 12:18 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > in the boostrap.php i call a vendor script that does a lot of stuff > > > one of them is to get the punbb (a BB sofware) config > > > class foxtal > > { > > public $pun_config; > > { > > public function __construct() > ># Load cached config > >if (file_exists(PUN_ROOT.'/cache/cache_config.php')) > >require PUN_ROOT.'/cache/cache_config.php'; > > >if (!defined('PUN_CONFIG_LOADED') && $this- > > >_generate_config_cache()) > >require PUN_ROOT.'/cache/cache_config.php'; > > >$this->pun_config =& $pun_config; > > } > > [...] > > } > > > so i do $foxtal = & new foxtal(); > > > now in the layout and everywhere in my application i'd like to be able > > to do use $foxtal > > for example : echo $foxtal['o_cur_version'] in the defailt.ctp file > > > Is it possible ? > > > What do i need to do ? > > > Kind Regards. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Undefined variable: ... CORE\app\views\layouts\default.ctp
Inizialize the class in your app_controller and export it to views using the set() method. On Nov 21, 2007 12:18 PM, FoxMaSk <[EMAIL PROTECTED]> wrote: > > Hi, > in the boostrap.php i call a vendor script that does a lot of stuff > > one of them is to get the punbb (a BB sofware) config > > class foxtal > { > public $pun_config; > { > public function __construct() ># Load cached config >if (file_exists(PUN_ROOT.'/cache/cache_config.php')) >require PUN_ROOT.'/cache/cache_config.php'; > >if (!defined('PUN_CONFIG_LOADED') && $this- > >_generate_config_cache()) >require PUN_ROOT.'/cache/cache_config.php'; > >$this->pun_config =& $pun_config; > } > [...] > } > > so i do $foxtal = & new foxtal(); > > now in the layout and everywhere in my application i'd like to be able > to do use $foxtal > for example : echo $foxtal['o_cur_version'] in the defailt.ctp file > > Is it possible ? > > What do i need to do ? > > Kind Regards. > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Undefined variable: ... CORE\app\views\layouts\default.ctp
Hi, in the boostrap.php i call a vendor script that does a lot of stuff one of them is to get the punbb (a BB sofware) config class foxtal { public $pun_config; { public function __construct() # Load cached config if (file_exists(PUN_ROOT.'/cache/cache_config.php')) require PUN_ROOT.'/cache/cache_config.php'; if (!defined('PUN_CONFIG_LOADED') && $this- >_generate_config_cache()) require PUN_ROOT.'/cache/cache_config.php'; $this->pun_config =& $pun_config; } [...] } so i do $foxtal = & new foxtal(); now in the layout and everywhere in my application i'd like to be able to do use $foxtal for example : echo $foxtal['o_cur_version'] in the defailt.ctp file Is it possible ? What do i need to do ? Kind Regards. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---