Re: Accessing the 'media' attribute in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I have enough trouble getting my rather ancient brain around PHP, and
> was hoping that I could avoid getting involved with JavaScript.
> However it seems that it, or CSS, are the only possibilities for this
> case.

If I understood you correctly what you want is to change the style of
the page when the user is printing it.
As others mentioned before all you would have to do would be adding a
second style sheet for that purpose.

EXAMPLE:
<link rel="stylesheet" media="screen" href="/styles/main.css" type="text/css" />
<link rel="stylesheet" media="print" href="/styles/print.css" type="text/css" />

That would be all. Now if you want the user to have some kind of
preview when clickin on a "print the page" button or link
you need either JavaScript or PHP. The easiest way I could think of
would be using the same print style sheet.

For JavaScript have a look at this page ...
http://www.quirksmode.org/dom/changess.html

I think it should work in most modern browsers. Still doing it with
PHP will work in every browser, but requires the page to reload ...
For PHP have a look at this page ...
http://www.maratz.com/blog/archives/2004/09/21/10-minutes-to-printer-friendly-page/#printQuery

//A yeti

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux