Sunday, January 10, 2010

Creating a simple file from php script

$fp = fopen("products.xml","w");
if($fp){
// echo "file opened";
}
else{
//echo "failed to open";
}
if(is_writable($file_name)){
//echo "file is writable";
}
else{
//echo "file is not writable";
}

$data = '
.....................';
if(fwrite($fp, $data)){
//echo "data written";
}else{
//echo "fail to write data";
}
fclose($fp);

Acessing the global configuration in joomla

Hi
In order to retrieve the value of any variable found in the configuration file use this code
global $mainframe;
$mainframe->getCfg('mailfrom');
$mainframe->getCfg('fromname');