How to use PHP to add text for Zen Cart?
January 23rd, 2010 — adminI want to add some text at the footer of Zen Cart, how to do? In fact, it is very simple. Just modify some code as the following.
I want to add some text at the footer of Zen Cart, how to do? In fact, it is very simple. Just modify some code as the following.
str_replace
(PHP 4, PHP 5)
str_replace — Replace all occurrences of the search string with the replacement string
$vowels = array(”a”, “e”, “i”, “o”, “u”, “A”, “E”, “I”, “O”, “U”);
$onlyconsonants = str_replace($vowels, “”, “Hello World of PHP”);
When you run wordpress under xamm,
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 334230 bytes) in D:\xampp\htdocs\test.php on line814.
1. Open \xampp\apache\bin\php.ini .Do not go to the directory of phpt to find php5.ini .
2. Search”memory” and get the following:
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 60 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 32M ; Maximum amount of memory a script may consume (16MB)
3. Modify the value of “memory_limit =” ,usuall change it to 64M.
4. Reboot Apache.
trim
(PHP 4, PHP 5)
trim — Strip whitespace (or other characters) from the beginning and end of a string
get_ip_list below is a function that you must call in order to get something.
function get_ip_list() {
$tmp = array();
if (isset($_SERVER[’HTTP_X_FORWARDED_FOR’]) && strpos($_SERVER[’HTTP_X_FORWARDED_FOR’],’,')) {
$tmp += explode(’,',$_SERVER[’HTTP_X_FORWARDED_FOR’]);
} elseif (isset($_SERVER[’HTTP_X_FORWARDED_FOR’])) {
$tmp[] = $_SERVER[’HTTP_X_FORWARDED_FOR’];
}
$tmp[] = $_SERVER[’REMOTE_ADDR’];
return $tmp;
}
echo echo implode(”,”,get_ip_list());
The problem: we have an array of items in PHP and we want to find out if a specific item is in the array. In code we can define the array as:
Read the rest of this entry »
ucfirst — Make a string’s first character uppercase
example:
$coo= ‘clay desiccant!’;
$coo= ucfirst($desiccant); // Clay desiccant!
$bar = ‘CLAY DESICCANT!’;
$bar = ucfirst($bar); // CLAY DESICCANT!
$bar = ucfirst(strtolower($bar)); // Clay desiccant!
$dirname=”E:/zhanzhongjie/chengbiao-com/chengbiao-com”;
$dir_handle=opendir($dirname);
while($file=readdir($dir_handle)) Read the rest of this entry »
/*random function
$length: length of needed number
*/
function random($length) {
$hash = ”;
$chars = ‘0123456789′;
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
} Read the rest of this entry »
— Renames a file or directory
Description
bool rename ( string $oldname , string $newname [, resource $context ] )
Attempts to rename oldname to newname . Read the rest of this entry »