to parse url from a plain string and add html hyper link to url:
ereg_replace("http://([a-zA-Z0-9./-]+)$", "<a href=\"\\0\">\\0</a>", $text);
from source. more »
Tags: url
yii: default home page
default home page in yii goes to site/index. what if you wants to use a different controller, module or view for home page?
config rules in urlManager
in config/main.php,
...
'components' => array(
'urlManager' => array(
'rules… more »
yii: authenticated user only access to a module
to allow authenticated user only to the whole module, instead of repeating codes to define access rules in all controller files, just add the following code to the module file in beforeControllerAction() function:
public function beforeControllerActio… more »
php: parsing search engine friendly url
a typical url looks like this:
some_domain/index.php?section=about&content=me
a search engine friendly url looks like this:
some_domain/index.php/about/me
to get the ‘/about/me’ part of the url, it’s returned by standard php variable $_SERVER[’… more »
php: get current url
"http" . ($_SERVER['HTTPS']) ? "s" : "") . "://" .
$_SERVER['SERVER_NAME'] .
((in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? "" : ":" . $_SERVER['SERVER_PORT']) .
"/"
$_SERVER[’HTTPS’] will be non-empty value if it’s running over ssl or usi… more »