[pmwiki-users] variable returns domain name?

Tegan Dowling tmdowling at gmail.com
Fri Apr 13 08:37:09 CDT 2007


On 4/13/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Apr 13, 2007 at 07:33:44AM -0500, Tegan Dowling wrote:
> > Hi, List:
> >
> > I've looked through http://www.pmwiki.org/wiki/PmWiki/PathVariables
> > and other pages listed on http://www.pmwiki.org/wiki/PmWiki/Variables,
> > but if what I want is there, I didn't recognize it (and so apologize).
> >  I'm looking for a variable that will provide my site's domain name,
> > stripped of the URL's "http://www.", so, for instance, on the PmWiki
> > site, it would return simply pmwiki.org.
> >
> > 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." .
>
> I much prefer this to the {(substr {$ScriptUrl} ...)}
> approach, if only because {$SiteDomain} is definitely much
> more descriptive.

Agreed:  Which would be the best Variables page of the docs for this?



More information about the pmwiki-users mailing list