DALLASCAO.COM

Site of Cao Shouguang, English to Chinese translator


Warning: Missing argument 1 for shapeshifter_archive_page_title(), called in /var/www/dallascao.com/en/wp-content/themes/shapeshifter/tag.php on line 7 and defined in /var/www/dallascao.com/en/wp-content/themes/shapeshifter/includes/functions-do-actions.php on line 142

Tag: php

PHP: create random password

PHP: create random password
$str = "0123456789abcdefghijklmnopqrstuvwxyz"; $n = 8; $len = strlen($str)-1; for($i=0 ; $iRead More

Change your php and mysql timezone

Change your php and mysql timezone
date_default_timezone_set('PRC'); Changes the timezone to China (+8) If you use mysql database, you will also need to use mysql_query("SET time_zone = '+8:00'"); to change the the timezone of mysql database.Read More

Use regular expressions in .htaccess for redirections

Use regular expressions in .htaccess for redirections
Task one: Apache server provides a .htaccess file using which you can use to redirect URLs. For example, if you want to redirect all visitors to http://dallascao.com/cn/ to http://dallascao.com/en/, you can open the .htaccess file at the root, and then input: RewriteRule ^cn\/?$ en\/ Translating the code in English, it means “Please replace ‘^cn\/?$’ with […]Read More

Use cookies to remember the language version users visited last time (php code)

Use cookies to remember the language version users visited last time (php code)
This site is bilingual. http://dallascao.com/cn/ is the Chinese version and http://dallscao.com/en/ is the English version. When you visit http://dallascao.com/, you are directed to either /cn/ or /en/ according to the default language of your browser or the version you visited last time.Read More

The context sensitive Language Versions link

The context sensitive Language Versions link
Most bilingual sites only have a fixed link to the other language version. Wherever you are on one language version of a site, clicking on the Language Version link always takes you to the home page of the other version of the site. But I want my visitors get the exact page they are viewing written in the other language. I used the javascript replace method to make it work.Read More