• Welcome to The Cave of Dragonflies forums, where the smallest bugs live alongside the strongest dragons.

    Guests are not able to post messages or even read certain areas of the forums. Now, that's boring, don't you think? Registration, on the other hand, is simple, completely free of charge, and does not require you to give out any personal information at all. As soon as you register, you can take part in some of the happy fun things at the forums such as posting messages, voting in polls, sending private messages to people and being told that this is where we drink tea and eat cod.

    Of course I'm not forcing you to do anything if you don't want to, but seriously, what have you got to lose? Five seconds of your life?

Printer-unfriendly pages

Shiny Grimer

Active member
Pronoun
she/her, they/them
I had this idea of making printer-friendly pages so that if someone wants to print my content, they get taken to a print-friendly version of that page and then print it. Now, I could make a separate page for every version of my website, but I figured there had to be an easier way to do it. So, I find this and see that there's an SSI version in the comments.

Code:
<!--#if expr="$QUERY_STRING = 'q=printme'" -->
<link rel="stylesheet" type="text/css" href="print.css" />
<!--#else -->
<link rel="stylesheet" type="text/css" href="default.css" />
<!--#endif -->

Now, this sounds dandy, but I have a style-switcher. I decide to work around that later and make a print.css. I do as the article says, with the
Code:
<a href="?q=printme">printer friendly version</a>
thing. However, no matter which style I use, <a href="http://www.theredblimp.com/test.shtml">the menus are gone</a>. I even put visibility:visible on the other stylesheets to 'counter' the print.css, but it still removes them. What can I do about this?

I was thinking about maybe using the ASP, but that would mean using a different extension .asp, and that would make my SSI not work. If there were some sort of Server-side includes for ASP or ASP.net, I'd switch all my pages to it, but I haven't been able to find such a thing. Is there?

Finally, if none of that works out, is there anything I can do with SSI so that I have a link on each page that basically says "theredblimp.com/print/thispagename.[extension]"? Basically, I want to fill the thing that says thispagename with each page's name so that I can put it in left.txt and have it be different for each page without having to put it in the actual content and edit it for each page.

Oh, and if anyone has any other solution (other than ditching the printer-friendly pages idea), I'm all ears.

EDIT: I don't want to do this:
Code:
<link rel="stylesheet" type="text/css" media="print" href="print.css">
because sometimes readers want to print out the nav or the ads or for some reason want the page as it appears on their computer. I want to give my users a choice: print it like this or as printer-friendly.
 
Last edited:
That works, so thanks. It also got rid of the annoying problem that I couldn't change the stylesheets later.

However, now whichever stylesheet I'm using will have its properties apply to the print page, which is a problem since now the print page will turn purple, green, and yellow. Even though I specifically set background to #fff, the other stylesheet applies.

I am so close here; it really bothers me that this stupid thing is preventing me from making this. :/
 
How about instead of having a special print page just having a print-friendly style?
 
How about instead of having a special print page just having a print-friendly style?

I thought about that, but do printers differentiate between styles? I thought about it, but that bothered me.

If having special pages won't work, I guess I could do that. It's much better than remaking each page into a separate page. :P
 
However, now whichever stylesheet I'm using will have its properties apply to the print page, which is a problem since now the print page will turn purple, green, and yellow. Even though I specifically set background to #fff, the other stylesheet applies.
Are you saying that you have two linked stylesheets and only want one to apply to the printed version? If you want a stylesheet for computer screens only then use media="screen".

If you want the default stylesheet to apply except when it conflicts with the print stylesheet, I guess you could stick !important everywhere. Or read up on CSS precedence.
 
Last edited:
Back
Top Bottom