[Pmwiki-users] wikifarm - logo: Problem solved (variable substitution too early)

John Rankin john.rankin
Wed May 26 16:24:25 CDT 2004


On Thursday, 27 May 2004 1:33 AM, Patrick Ogay <lists at basel-inside.ch> wrote:
>It's tricky this variable substitution in php.

Tell me about it!!

>Logo-Error solution:
>pog
>
><?php
>##
>## This adds support for wiki farms -- different sites that share a
>## common code base
>##
>SDV($PageLogoUrl,"$PubDirUrl/skins/pmwiki/pmwiki-32.gif");
>
>//** $variables at beginning!!!
>//** \$PageLogoUrl  IMHO resolution at the correct time
>// $ScriptUrl doesn't change?

Ah, but $ScriptUrl *does* change, so you have to set $PageLogoUrl
before you include wikifarm-pre.php -- the 'SDV' means that if it's 
already set, it won't be over-written.

To make the farm work without modifying pmwiki itself, we change 
$ScriptUrl to "$ScriptUrl/~Fieldname"  -- there may be a better way,
but we couldn't think of one.

This means we have to set $PageLogoFmt *before* we mess with
$ScriptUrl, otherwise the logo points to the home page of the
current field, instead of the home page in the common area.

Of course in some cases, this might be a desirable behaviour,
in which case you can redeclare $PageLogoFmt after including 
wikifarm-pre.php. In our situation, we want the logo always to
point to the common home page of the wiki.

>
>SDV($PageLogoFmt,"<div id='wikilogo'><a href='$ScriptUrl'><img
>   src='$PageLogoUrl' alt='$WikiTitle' border='0' /></a></div>");
>SDV($FieldListPage,"Main.WikiFarm");
>SDV($FieldAfterWikiTitle,0);
>
>include("local/wikifarm-scripts/fieldlist.php");
>include("local/wikifarm-scripts/fieldconf.php");
>include("local/wikifarm-scripts/fieldname.php");
>include("local/wikifarm-scripts/fieldsetup.php");
>include("local/wikifarm-scripts/fieldcust.php");
>
>?>
>
>
>-- 
>Pmwiki-users mailing list
>Pmwiki-users at pmichaud.com
>http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com
>


-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list