WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.

Donate with PayPal buttonSpenden mit dem PayPal-Button

  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • How to create a print.css?
  • Print
Pages: [1]   Go Down

Author Topic: How to create a print.css?  (Read 6643 times)

Offline pszilard

  • Posts: 75
  • Gender: Male
    • RemekTek
How to create a print.css?
« on: September 01, 2008, 03:27:49 AM »
I am using the andreas08 template on my site, but this question really applies to all as a general question.

I would like to add a "Print" link, which would print the page contents, without the menus and banners, etc. I think the answer is to use a print.css, but I need help please;

1) How do I create (or modify) a print.css
2) Does print.css need to be template specific, or can I use a "general" one
3) Once added to the template, how do I actually use it? I.e. how to create a link that will call it?
4) I would like to use similar functionality as GMAIL's "PRINT", which opens a new tab of just the page contents without the banners, and menus or side bars.

Thanks in advance...
Logged
Paul Szilard
WB user since Dec 2007:
http://www.remektek.com.au/wb
http://photos.remektek.com.au/ for my photo portfolio

chio

  • Guest
Re: How to create a print.css?
« Reply #1 on: September 01, 2008, 08:42:30 AM »
You are talking about different things

I usually have some small extra code at the end of the "normal" css (which has no "media" attribute.
This little code is for printing only and hides some blocks when printing (See Print preview on your browser)

Code: [Select]
/*-------------------------PRINT-----------------------------*/
 
@media print {

 .nopr, #leftbox, #topmenu, #footerbox, #gecko_scrollbar {display:none;}
 #mainbox {width:80%; margin-left:15%}

}

Another thing is to have a different template for printing - this hasn't to do with print.css, it is a normal (screen)css, which is specially made for printing.

The best way is to have a parameter (like index.php?style=print) to switch between the templates. Or change the css with javascript.
Logged

Offline StefanRSA

  • Posts: 97
  • Gender: Male
  • Just Me... Baking...
    • THE HOST
Re: How to create a print.css?
« Reply #2 on: September 01, 2008, 09:30:33 AM »
Its actually easy thing to do but a nightmare if you just don't know what to do....
Had the same problem and the slution found was as follow:

Create a print.css file and specify what should be displayd (To print) and what should not:
#news { display: none; }
 #content {  font: Verdana, Arial, Helvetica, sans-serif; color: black; }
 #footer {  display: none; }


Then in your template's index.php ad:
<link href="<?php echo TEMPLATE_DIR; ?>/print.css" rel="stylesheet" type="text/css" media="print" />

And also place the following where you want the print button to apear in your index.php :
<a href="javascript:window.print()" title="print page">
     <img src="<?php echo TEMPLATE_DIR; ?>/print.gif"  border="0" width="120" height="42" alt="Print This Page" />


Thats it.... Try it...
Logged
How can the sky be the limit? There is much more behind the sky!!!

Offline pszilard

  • Posts: 75
  • Gender: Male
    • RemekTek
Re: How to create a print.css?
« Reply #3 on: September 01, 2008, 11:44:37 AM »
Quote from: chio on September 01, 2008, 08:42:30 AM

Code: [Select]
/*-------------------------PRINT-----------------------------*/
 
@media print {

 .nopr, #leftbox, #topmenu, #footerbox, #gecko_scrollbar {display:none;}
 #mainbox {width:80%; margin-left:15%}

}


I've added your bit of code to the end of the .css and refreshed the template, however it had no effect whatever! Not sure why.
Logged
Paul Szilard
WB user since Dec 2007:
http://www.remektek.com.au/wb
http://photos.remektek.com.au/ for my photo portfolio

Offline pszilard

  • Posts: 75
  • Gender: Male
    • RemekTek
Re: How to create a print.css?
« Reply #4 on: September 01, 2008, 12:56:10 PM »
Quote from: StefanRSA on September 01, 2008, 09:30:33 AM
Its actually easy thing to do but a nightmare if you just don't know what to do....
Had the same problem and the slution found was as follow:

Create a print.css file and specify what should be displayd (To print) and what should not:
#news { display: none; }
 #content {  font: Verdana, Arial, Helvetica, sans-serif; color: black; }
 #footer {  display: none; }


Then in your template's index.php ad:
<link href="<?php echo TEMPLATE_DIR; ?>/print.css" rel="stylesheet" type="text/css" media="print" />

And also place the following where you want the print button to apear in your index.php :
<a href="javascript:window.print()" title="print page">
     <img src="<?php echo TEMPLATE_DIR; ?>/print.gif"  border="0" width="120" height="42" alt="Print This Page" />


Thats it.... Try it...

Thanks. I got it working! I removed the size definition of the print icon, and created a print icon to use. I also had to look in the screen.css to identify the parts on screen to not print and it all works. See my page at www.remektek.com.au

Thanks again.
Logged
Paul Szilard
WB user since Dec 2007:
http://www.remektek.com.au/wb
http://photos.remektek.com.au/ for my photo portfolio

Offline StefanRSA

  • Posts: 97
  • Gender: Male
  • Just Me... Baking...
    • THE HOST
Re: How to create a print.css?
« Reply #5 on: September 01, 2008, 01:56:38 PM »
Realy nice site Pszilard.

Its always a good thing to also not display your "Read More" links on the print page.... Unless you need it to display...

Glad I could Help!

Tell me, why dont you use the bakery or GoCart modules for your shop?
Logged
How can the sky be the limit? There is much more behind the sky!!!

Offline pszilard

  • Posts: 75
  • Gender: Male
    • RemekTek
Re: How to create a print.css?
« Reply #6 on: September 02, 2008, 12:33:21 AM »
Thanks for the positive feedback! I appreciate it, especially from an experienced Bakers :D. I'll need to find how to not print the Read More, as I don't think that they are a page "element" which I could then switch off. Any hints here would be welcome.

Re the Shop - it is still on the To Do list, however the shop module looked too time consuming to set up and offered little over the "news" format, especially as it doesn't allow some key features, which I can do using ShopFactory Pro (my example here), which is my intention for the future. For instance:
  • Loading contents from a spreadsheet interface
  • easy control over sort order
  • any item can appear in more than one category
I have a commercial license for ShopFactory, which is a few years old and down level, but it will do what I need. I intend to either run in a Wrapper module in WB or just have it on another link. Just haven't got enough time to develop it at the moment.

Having said that, if I could use a good WB based option, I would be very interested in that too.

Thanks again for the print solution! Cheers guys.
Logged
Paul Szilard
WB user since Dec 2007:
http://www.remektek.com.au/wb
http://photos.remektek.com.au/ for my photo portfolio

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • How to create a print.css?
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2