[pmwiki-users] Single Page background image

Hans design5 at softflow.co.uk
Thu Nov 22 16:46:41 CST 2007


Thursday, November 22, 2007, 9:00:20 PM, Dr Fred C wrote:

> I just want something simple like a having a directive/command of 
> (:backgroundpage mybackground.jpg:) that, when put into the main 
> section, would override the skin and set the background of the page to
> mybackground.jpg, or at least the main section to mybackground.jpg.  I
> suppose there might be a use for (:backgroundsection mybackground.jpg:)

Add this to config.php to define a
(:backgroundpage http://path/to/image/image.jpg :)
markup, which you then can use on any page:

Markup('backgroundpage', 'directives',
          '/\\(:backgroundpage\\s(.*?):\\)/e',
          "PageBackground(\$pagename, PSS('$1'))");

function PageBackground ($pagename, $arg) { 
        global $HTMLStylesFmt;
   $HTMLStylesFmt[] = " body { background:url($arg);} \n 
   #wikibody { background:transparent; } \n";
   return '';
};

This should work for the pmwiki default skin. Other skins differ.
You may still have the odd control like the searchbox without
background image. To get a background image applied to eveything one
needs to search out various elements and set their backgrounds to
transparent. You could add these to the function's $HTMLStylesFmt.


  ~Hans




More information about the pmwiki-users mailing list