Home » Archive

Articles in the PHP Category

Headline, PHP »

[23 Jun 2009 | One Comment | 593 views]

We want to post HTML codes on our posts for code examples, but this would create problems because the browser converts the HTML codes to tags.This is where the Online HTML escape tool comes in. this tool converts HTML tags with the correct  HTML entities escape characters so that it will be displayed as is.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1″ />
<meta name=”author” content=”raven” />
<title>My Page</title>
</head>
<body>
</body>
</html>

Magento, PHP »

[7 Mar 2009 | No Comment | 909 views]

Guys,
Magento has this problem with it’s upload image and browse images in the Manage Product page. Error console is saying:

throw new Error(myErrorMessage[1]);

Source file: “/js/lib/flex.js ”
The problem is that the upload code is not compatible with Flash Player 10.
a workaround is to first uninstall the flash player 10, and then download and install flash player 9:
uninstall your flash plugin/activeX through:
http://download.macromedia.com/pub/flashplayer/current/uninstall_flash_player.exe
install the old Flash 9 through:
http://download.macromedia.com/pub/flashplayer/updaters/9/flash_player_update6_flash9.zip
I know this is a short term solution. But Flash player 10 does this on purpose to prevent a security exploit. I guess the magento community will …

PHP »

[13 Oct 2008 | No Comment | 356 views]

Guys,
we can access our website with both www.domain.com and domain.com.  But there are times when search engines have already indexed your website under both addresses, that you can’t change that easily. But because these search engines penalizes this due to duplicated content reasons, you have to stick only one domain format.
The solution is to do a 301 redirect for all http requests, here is a htaccess code:
Redirect domain.com to www.domain.com:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$
RewriteRule ^(.*)$ http://www.domain.com/$1

Redirect www.domain.com to domain.com:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$
RewriteRule ^(.*)$ http://domain.com/$1

PHP »

[26 Jun 2008 | No Comment | 461 views]

If you are using Linux, and if you want to run a script in your PHP code in the background (this means PHP will not hang until the program finishes running). You use the “&” symbol at the end of your php declaration to tell it to run the script in background. Now together with the PHP exec() function, here’s a sample syntax:

<?php
exec(”php myscript.php >> output.txt & “);
?>

This will run the script myscript.php and outputs the result in text file output.txt. Now this will run the line of code …

PHP »

[25 Jun 2008 | No Comment | 1,423 views]

Definition:
The array_merge() function merges one ore more arrays into one array in such a way that the values of one array are appended to the end of the previous one. This functions returns an array.
Take note that if the given input arrays have the same string keys, then the later value for that key will overwrite the previous one. This is different if the arrays contains numeric keys/indeces, where in it DOES NOT overwrite the later value of the same key but will append it. Thus, resetting …