The best way is to store the Settings in your Database, but in some case this is not important, than you can use an array in a settings.php or config.php
This can look like this: (settings.php)
<?php
$settings = array();
/* MAX_PHOTOS */
$settings['max_photos'] = 30;
/* MAX_WIDTH */
$settings['max_width'] = 30;
?>
and the best way is to get the settings with an class (settings.class.php), in this case settings.class.php and settings.php should be in the same folder, you can change it :)
Here an example of a settings.class.php
<?php
require_once( 'settings.php' );
class Settings
{
public $s;
public function __construct()
{
global $settings;
$this->s = $settings;
}
/* CHANGE $this->get_normal to $this->get_db, if you want to use it with a Database */
public function get( $get )
{
return $this->get_normal( $get );
}
public function get_normal( $get )
{
if( isset( $this->s[trim( $get )] ) )
{
return $this->s[trim( $get )];
}
return FALSE;
}
public function get_db( $get )
{
$db_connect = mysql_connect('HOST', 'USER', 'PASSWORD');
$db_select = mysql_select_db( 'DATABASE' );
$query = sprintf( "SELECT * FROM settings WHERE key='%s'", mysql_real_escape_string( trim( $get ) ) );
$db_query = mysql_query( $query );
mysql_close( $db_connect );
if( $db_query )
{
while( $array = mysql_fetch_array( $db_query, MYSQL_ASSOC ) )
{
return $array[ trim( $get ) ];
}
}
return FALSE;
}
}
?>
and if you need later a Database, you can change only the class and you have not to change your whole sourcecode.
You can change $this->get_normal to $this->get_db, if you want to use it with a Database, I have not tested the Database Query and the Database Connect, but this is only an example how it would look like :)
I hope it helps you!