[pmwiki-users] Editing CSS and JS files

Dominique Faure dominique.faure at gmail.com
Thu Jan 26 13:21:28 CST 2006


2006/1/26, Jon Haupt <jhaupt at gmail.com>:
> On 1/26/06, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > On Thu, Jan 26, 2006 at 09:20:20AM -0600, Jon Haupt wrote:
> > >    I've been trying to get CSS to function in this way here:
> > >
> > >    http://www.pmwiki.org/wiki/Cookbook/CSSInWikiPages
> > >
> > >    But so far have had little success.  The markup we came up with for
> > >    (:stylesheet:) doesn't seem to work, and I can't figure out how to
> make
> > >    the wiki use the source text of a wiki page without calling
> > >    ?action=source.  I'm still fairly certain it has to work, but haven't
> had
> > >    the time to tinker with it any more.
> >
> > To grab the text of a wiki page, just do:
> >
> >     $page = ReadPage($pagename, READPAGE_CURRENT);
> >     if (!$page) { "page doesn't exist"; }
> >     $text = $page['text'];
> >
> > To get the text only if the current visitor has read
> > authorization, use:
> >
> >     $page = RetrieveAuthPage($pagename, 'read', false, READPAGE_CURRENT);
> >     if (!$page) { "page doesn't exist or is read protected"; }
> >     $text = $page['text'];
> >
> > Pm
> >
>
> Alright, so how do I refer in markup directly to a particular page (e.g.
> $SiteGroup.StyleSheet)?  as in
>
>   $page = ReadPage('$SiteGroup.StyleSheet',
> READPAGE_CURRENT);
>   if (!$page) { "page doesn't exist"; }
>   $stylesheettext = $page['text'];
>   $HTMLStylesFmt['skincss'] = $stylesheettext;
>
> When I put this into skin.php, nothing happens.  What's not right here?  Am
> I not allowed to substitute for $pagename like that?  or am I not allowed to
> stick $stylesheettext in like I did?
>

The pagename definition you provide ('$SiteGroup.StyleSheet') must be
"resolved" (variables, i18n,... replaced with their values) before
all. This process is done relatively to the current page being
browsed:

global $pagename;

$pn = FmtPageName('$SiteGroup.StyleSheet', $pagename);
$page = ReadPage($pn, READPAGE_CURRENT);
if (!$page) { "page doesn't exist"; }
$stylesheettext = $page['text'];
$HTMLStylesFmt['skincss'] = $stylesheettext;

Dom




More information about the pmwiki-users mailing list