#50 Fix for default printer stylesheet


Having seen other sites do it, I always wondered why I
couldn't have one stylesheet for 'screen' and another
for 'print' and have the browser automatically print
every page in a printer-friendly fashion. I think I
now know why this is. The setDefaultCSS only allows for
one stylesheet, but if you want to set the default
stylesheet for printers, you need more than one. So
I've added a function in Theme.php called addDefaultCSS:

function addDefaultCSS ($title, $css_file, $media =

false) {
$this->_alternateCSS[$title] =
$this->_CSSlink($title, $css_file, $media);

This is just the same as addAlternateCSS, except that
the call to _CSSlink doesn't have a false as the last
argument. Now I can do:
$Theme->setDefaultCSS('fiapple', 'fiapple.css', 'screen');
$Theme->addDefaultCSS(false, 'phpwiki-printer.css',

This seems to work for Mozilla, and in IE, and of
course completely fails(-safe) on Netscape 4.x.

In doing this, I also made a mod to XmlElement.php, so
that it prints a newline between elements of an array:

function _pushContent_array ($array) {
    foreach ($array as $item) {
        if (is_array($item))
        else {

I hope this helps...someone...BTW these changes are to
the latest CVS as of a few weeks ago. I can't connect
to Sourceforge CVS for some reason.



Log in to post a comment.