[pmwiki-users] variable returns domain name?

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Sat Apr 14 07:38:42 CDT 2007


On Fri, 13 Apr 2007, Patrick R. Michaud wrote:

>> Is there such a animal, and if not is it possible to create a custom 
>> one?
>
> $FmtPV['$SiteDomain'] =
>  "'" . preg_replace('!^\\w+://(www\.)?!', '', \$ScriptUrl) . "'";
>
> After this you can use {$SiteDomain} to get the site's domain name 
> stripped of any leading "www." .

Just a comment that the above does not work if you've set $ScriptUrl to 
e.g. '/'.  (Or have we said that $ScritpUrl is always a full/complete 
URI?)

/Christian

-- 
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr


More information about the pmwiki-users mailing list