| 
	
 | 
 Posted by "A.J. Brown" on 09/27/05 17:35 
Are you wanting the preferences to be real-time changeable?  For example,  
user preferences that can be modified then saved?  If so, just store them in  
an array, then serialize the array and save it to a file.  Read the file at  
every page load. 
 
[code] 
 
//save the settings 
$user_settings['setting1'] = 'foo'; 
$user_settings['setting2'] = 'bar'; 
 
$fh = fopen('user_settings.dat'); 
$serialized = serialize($user_settings); 
fwrite ($fh, $serialized, strlen($serialized)); 
fclose($fh); 
 
//reload the settings 
$user_settings = unserialize(file_get_contents('user_settings.dat')); 
 
 
[/code] 
 
 
Hope this helps. 
 
--  
 
Sincerely, 
 
A.J. Brown 
 
 
 
"Jay Blanchard" <jay.blanchard@THERMON.com> wrote in message  
news:0CEC8258A6E4D611BE5400306E1CC92708D47293@smtmb.tmc.local... 
> [snip] 
> I'd like to save some program preferences to a txt file where they can be 
> recalled and updated at a later time. Basically this will be a variable  
> name 
> 
> and a value. Can someone suggest a reference or method to best perform  
> this 
> task? 
> [/snip] 
> 
> Open a new file, save stuff to it, close the file. 
> Include the file where you need the prefs. 
> 
> http://www.php.net/fopen 
> http://www.php.net/explode
 
  
Navigation:
[Reply to this message] 
 |