osCommerce Migration Tool block 0%

October 23, 2009

Change path: app\code\core\Mage\Oscommerce\Block\Adminhtml\Import\Run.php, line no 160:

Change code
new Ajax.Request(“‘.$this->getUrl(‘*/*/batchRun’).’”, {
method: “post”,
to
new Ajax.Request(“‘.$this->getUrl(‘*/*/batchRun’).’”, {
method: “get”,


Changing class name using javascript

July 25, 2009

We can change the element css classname using java script

document.getElementById("myid").className="myclass";

Here myid is the id name of your element and myclass is the new class name of that element.


How to count the words from a string using php

May 5, 2009

Any one can easily find out the number of word in a string using the code below.

<?php
$your_string = “This is test a string.”;
$words = count(explode(“ ”, $your_string));
echo "$your_string contains $words words";
?>

My first developed WordPress Theme

March 29, 2009

This is my first developed WordPress Theme.Its name loan.I developed this under the Pixelnet Technologies.

Screenshot of it.
screenshot


Finding the common elements in two arrays

February 5, 2009

Finding the common elements in two arrays is very easy.Just use a function array_intersect().

array array_intersect ( array $array1 , array $array2 [, array $ ... ] )

example:

<?php
$array1
= array("a" => "green", "red", "blue");
$array2 = array("b" => "green", "yellow", "red");
$result = array_intersect($array1, $array2);
print_r($result);
?>

The above example will output:

Array
(
    [a] => green
    [0] => red
)

Convert text to image in php

January 9, 2009

Sometime we need to convert string into image.But it is not hard.You can easily do this by following code in php.

<?
//Text Convert to Image
$text=”Hello word”;
//Create an image  width=120 and height=25
$img = imagecreatetruecolor(120,25);
// Set Background Color
$bgcol = imagecolorallocate($img,225,235,215);
// Set Text Color
$textcol = imagecolorallocate($img,54,32,212);
//Set Background
imagefill($img,0,0,$bgcol);
//Draw String
imagestring($img,3,8,4,$text,$textcol);

header(“Content-type: image/png”);
imagepng($img);
imagedestroy($img);
?>


Export MySQL table data to CSV using PHP Script

December 27, 2008

The CSV file format is a file type that stores tabular data usually processed in applications like Microsoft Excel (XLS).You can easily export Mysql data to CSV file format using PHP Script.
Code Given below:

<?

$host = 'localhost'; //your Hostname
$user = 'username'; //Database Username
$pass = 'userpassword'; //Database Pasword
$db = 'userdb'; //Database name
$table = 'user_table'; //Table name
$file = 'export'; //CSV File name

$link = mysql_connect($host, $user, $pass) or die(“Can not connect.” . mysql_error());
mysql_select_db($db) or die(“Can not connect.”);

$result = mysql_query(“SHOW COLUMNS FROM “.$table.”");
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$i++;
}
}
$values = mysql_query(“SELECT * FROM “.$table.”");
while ($rowr = mysql_fetch_row($values)) {

for ($j=0;$j<$i-1;$j++) {

$csv_output .=’”‘.$rowr[$j].”\”; “;
}
$csv_output .=’”‘.$rowr[$j].”\”";
$csv_output .= “\n”;
}

$filename = $file.”_”.date(“Y-m-d_H-i”,time());
header(“Content-type: application/vnd.ms-excel”);
header(“Content-disposition: csv” . date(“Y-m-d”) . “.csv”);
header( “Content-disposition: filename=”.$filename.”.csv”);
print $csv_output;
exit;
?>


Creating Horizontal menu

December 23, 2008

/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */

.aerobuttonmenu{ /*container that holds a row of aero buttons*/
overflow: hidden; /*See: http://www.quirksmode.org/css/clearing.html */
width: auto;
background: #F7F7F7; /*menu strip background*/
border: 1px solid gray;
padding: 4px 0;
border-width: 1px 0;
}

* html .aerobuttonmenu{ /*IE6 and below hack. Set explicit strip width*/
width: 100%;
}

.aerobuttonmenu a.aero{ /*aero button CSS*/
background: transparent url(‘media/aeroleft.gif’) no-repeat top left;
display: block;
float: left;
font: bold 13px Verdana, Trebuchet MS; /* Change 13px as desired */
line-height: 23px; /* This value + 8px should equal height of button background (default is 31px) */
height: 31px; /* Height of button background height */
padding-left: 10px; /* Width of left menu image */
text-decoration: none;
margin-right: 5px; /*spacing between buttons*/
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=90); /*this and next two rules control opacity of buttons before hover*/
opacity: 0.9;
-moz-opacity: 0.9;
}

.aerobuttonmenu a.aero:link, .aerobuttonmenu a.aero:visited, .aerobuttonmenu a:active{
color: white; /*button text color*/
}

.aerobuttonmenu a.aero span{
background: transparent url(‘media/aeroright.gif’) no-repeat top right;
display: block;
padding: 4px 10px 6px 0; /*Set 10px here to match value of ‘padding-left’ value above*/
}

.aerobuttonmenu a.aero:hover{ /* Hover state CSS */
filter:progid:DXImageTransform.Microsoft.Alpha(opacity=100); /*this and next two rules control opacity of buttons during hover*/
opacity: 1;
-moz-opacity: 0.99;
}

.aerobuttonmenu a.aero:hover span{ /* Hover state CSS (for text) */
color: yellow;
}

.black a.aero{
background-image: url(‘media/aeroleftblack.gif’);
}

.black a.aero span{
background-image: url(‘media/aerorightblack.gif’);
}

.aerobuttonmenu .rightsection{
float: right;
width: 100px;
position: relative;
top: 3px;
padding-right: 5px;
text-align: right;
}

.aerobuttonmenu .rightsection a{
color: navy;
}


Eid-ul-Azaha2008(আমার বািড় েফরা)

December 13, 2008

Finding latitude and longitude in Google Map

November 25, 2008

You can easily find out longitude and latitude from Google map.Give an address and find out longitude and latitude.
<?
// Your Google Maps API key
$key = "YOUR_KEY_HERE";

$mapaddress = urlencode(“$address $city $state”);

// Desired address
$url = “http://maps.google.com/maps/geo?q=$mapaddress&output=xml&key=$key”;

// Retrieve the URL contents
$page = file_get_contents($url);

// Parse the returned XML file
$xml = new SimpleXMLElement($page);

// Parse the coordinate string
list($longitude, $latitude, $altitude) = explode(“,”, $xml->Response->Placemark->Point->coordinates);

// Output the coordinates
echo “latitude: $latitude, longitude: $longitude
“;
?>