Site Reconstruction

#sunday, 28th june 2015 at 08:56am

Categories :

Please excuse all old contents on this site and the mobile incompatible layout issue. I'll post more articles which may be useful to developers like me as soon as my new site is launched.

CodeIgniter Dynamic base_url

#saturday, 11th february 2012 at 05:31am

Categories : Tips and Tricks

As CodeIgniter user myself, it is often part of my every CI-Based projects to have set base_url dynamically:

if(isset($_SERVER['HTTP_HOST']))
{
$config['base_url'] = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https' : 'http';
$config['base_url'] .= '://'. $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}
else
{
$config['base_url'] = 'http://localhost/';
}

Categories

Widget Error

The Weather feed URL is not reachable
http://weather.yahooapis.com/forecastrss?w=1177694&u=c

Widget Error

The Weather feed URL is not reachable
http://feeds.howstuffworks.com/DailyStuff