Sunday, January 30, 2011

Re: Configuration

Nick Baker aka WebtechNick has a settings plugin

you can also add settings from with app/config/bootstrap.php

$imageSettings = array();
$imageSettings['thumb'] = array(125, 200);
$imageSettings['large'] = array(400, 600);

Configure::write('Site.images', $imageSettings);

then elsewhere $thumbSizes = Configure::read('Site.images.thumb');

debug($thumbSizes); // outputs
Array (     [0] => 125     [1] => 200 ) 


(Just noticed that Tom has replied with much of the info I would add here)

you would use this none plugin method.

Nick plugin is here (other simular plugins exist too)
https://github.com/webtechnick/CakePHP-Configuration-Plugin




On 30 January 2011 19:35, elias <elias.lecomte@gmail.com> wrote:
That is the best way to store global configuration stuff in cakephp?

Can the following problem also be solved with storing in in a table?

A group of image width and height's values
  • 125 X 200
  • 400 X 600
  • 1024 X 768
But their needs to be a possibility to add more values.
When the image upload scripts get's an image uploaded, it checks al these values and makes resized images for each of the values.
So if their are only 2 widht+height values, only 2 images get generated.
But when the admin ads additional values more images get generated.

I would assume then that i also would have to make another table, and link this with a $hasMany ?

But for each change in these settings I would have to alter the database.
Isn't their another (easier) possibility?
Maybe one that uses an xml file to store everything?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: