Reputation: 189
I am using cakephp v2.3.4
Have set in the /app/Config/bootstrap.php a global variable as follow;
Configure::write('Bike.Frontwheel','Gazette, 16 inch');
I am not able to see this value in my any of my views, what am I doing wrong? I am able to change the value in a controller with:
Configure::write('Bike.Frontwheel', $Data['Bike']['description']);
Code in the view:
<?php echo Configure::read('Bike.Frontwheel'); ?>
Upvotes: 0
Views: 3149
Reputation: 1826
try in the config folder,
for this you need to create a file in the config
folder & load that in the bootstrap
as shown
Configure::load('custom');
this shows that your file is custom.php now you can write as
$config['Bike.Frontwheel'] = 'Gazette, 16 inch';
where ever you need you can call this as
$variable = Configure::read('Bike.Frontwheel');
Upvotes: 0
Reputation: 7465
Set the variable in your controller so that it gets passed to your view:
$this->set('front_wheel', Configure::read('Bike.Frontwheel'));
Then in your view:
<?php echo $front_wheel; ?>
Upvotes: 4