[Pmwiki-users] DevQ 4: $PubDirURL problem
Jonathan Scott Duff
duff
Thu Apr 1 09:12:36 CST 2004
On Thu, Apr 01, 2004 at 11:35:51AM -0800, Steven Leite wrote:
> I actually have a minor question first .. I'm trying to figure out the
> regexp (below), which I need it in order for my wiki to run properly.
> I'm running WindowsXP using OmniSecureHTTPD Server.
>
> I'm just trying to understand what this regexp does.
>
> preg_replace("#/[^/]*\$#","",$ScriptUrl,1);
The # are delimiters for the RE, they are different from the standard
delimiter / so that you can use a / in the RE without backwhacking it.
[^/] is a character class that matches anything that is NOT a /
character. $ matches the end of the string. (It's escaped to prevent
interpretation as a variable within the double quoted string)
So what that regular expression says is "match a slash (/) followed by zero or
more non-slash characters at the end of the string" where $ScriptUrl
is the string in this case.
> also, $PubDirUrl doesn't seem to be available to my other scripts,
> even though they are included after the code above.
Are you using it within a function? If so, you need to put "global
$PubDirUrl" within the function to access the variable. (And if your
assignment happens within a function, you need to globalize it there
too)
As long as you've assigned and used $PubDirUrl outside of any function
declaration, it should work just fine.
-Scott
--
Jonathan Scott Duff
duff at pobox.com
More information about the pmwiki-users
mailing list