Friday, July 30, 2010

virtuemart toolbar, removing and adding items to it

to change the items like suppose you create a custom new page in virtuemart and you are confused about the toolbar it can be handled from the file toolbar.virtuemart.php this file lie in the root folder of the administratorc/components/com_virtuemart
if you dont want the new button in the toolbar then add ur page to this array
$noNewItem = array( 'order.order_list',
'store.shipping_module_list','report.report_list' );

Thursday, July 29, 2010

get consecutive dates between any two dates

function getDays($sStartDate, $sEndDate){
// Firstly, format the provided dates.
// This function works best with YYYY-MM-DD
// but other date formats will work thanks
// to strtotime().
$sStartDate = gmdate("Y-m-d", strtotime($sStartDate));
$sEndDate = gmdate("Y-m-d", strtotime($sEndDate)); //Y-m-d
// Start the variable off with the start date
//$aDays[] = $sStartDate;
$ex = explode("-",$sStartDate);

$aDays[] = $ex[1] ."/" .$ex[2] . "/" . $ex[0];

// Set a 'temp' variable, sCurrentDate, with
// the start date - before beginning the loop
$sCurrentDate = $sStartDate;

// While the current date is less than the end date
while($sCurrentDate < $sEndDate){
// Add a day to the current date
$sCurrentDate = gmdate("Y-m-d", strtotime("+1 day", strtotime($sCurrentDate)));

// Add this new day to the aDays array
$ex = explode("-",$sCurrentDate);

$aDays[] = $ex[1] ."/" .$ex[2] . "/" . $ex[0]; //$sCurrentDate;
}

for ($i=0;$i<4;$i++){

// print_r($aDays[$i]);

}

// Once the loop has finished, return the
// array of days.
return $aDays;
}

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');

Saturday, December 12, 2009

Tuesday, November 24, 2009

htacess to redirect url to www

Below is the .htacess code for redirecting the url request to www.
RewriteEngine On


RewriteCond %{HTTP_HOST} ^abdulbasitnawab.com [NC]
RewriteRule ^(.*)$ http://www.abdulbasitnawab.com/$1 [L,R=301]

Thursday, October 29, 2009

Changing charater set in mysql

If we have stored the values in the tables in other languages than english then while selecting use this mysql query to convert the charset
"SET CHARACTER SET 'utf8'"