Recent Topics

1 Apr 04, 2009 15:23    

My b2evolution Version: Not Entered

Hello all,

I realize this has been a topic of discussion somewhat lately, but I was wondering two things:

1) What are the views of the experts on this forum about the best way for a non-expert at PHP or CSS to implement a "print this" function so readers can print individual blog posts without having to see all the other stuff on the page?

2) Do you know of anyone working on a plugin to do this, presuming it is possible to do it with a plugin? (If it's not possible with a plugin, I'd like to know that too!)

Thanks again...this forum is a fantastic resource.


2 Apr 04, 2009 16:56

The absolute easiest way is with a style sheet, and you don't have to be an expert at CSS to handle a little bit of CSS. See and see if it makes sense...

A way to decide which bits get into the

#menu-top, #wrapper-menu-page, #wrapper-footer {
display: none;

section of your print.css is to do a "view source" and ask yourself if you want each major section printed. For example a sidebar probably doesn't need to be printed. I just looked at your "view source" and see this bit in there:

<!-- ================= START OF SIDEBAR =============== -->
<div class="bSideBar">

So now you add .bSideBar to the list of things that get "display: none" and your sidebar won't be printed.

It won't matter if the visitor is on a multi-post or single post or page-type page: whatever the print.css sheet says is what will and won't be printed ... everything else will.

3 Apr 04, 2009 17:08

Thanks, Ed.

Now a more basic question, and please feel free to point me to another place where this may have been answered already, but how do I actually get a "Print This" link to show up on the page and how do I set it so that clicking on it opens the display of the blog entry in the print-friendly CSS?

Thanks again for all your help.

4 Apr 04, 2009 17:50

No need for that. The visitor's browser will handle using the "print.css" file when they pick "file - print" :D

This is why having the {{media="whatever"}} part of the tags in the head section is important, by the way. In other words if you do

<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="stylesheet" href="print.css" type="text/css" />

it will bonk EVERYTHING! You absolutely need the last little detail on those two lines.

Anyway that's why I think this is the super-simplest model available. The style sheet isn't terribly hard to write, though it does take a wee bit of knowledge and effort. The owner gets to decide which bits will and won't get printed. And the visitor doesn't have to do anything other than use their browser.

Lots of times when I'm on a website for like financial stuff I look for a printme button. If it is there I use it, otherwise I'm forced to do a print preview just to see what junk they'll print along with the bits I need. Financial places will often do a printme button because ... well because they do. But for regular websites I hardly ever expect to find one. So I just print and hope it's not all buggered up. Sometimes have to reprint landscape just so the good bits aren't trashed eh? With a media="print" style sheet you get to be a regular website that prints nicely.

There was some talk of a print skin. It'd be something that has to get called in the head and makes a printable. Basically it'd be like a feed skin in that it got called with tempskin=whatever, but hey it either needs to be called as a media=print (which can't be) or it needs a button on every printable page.

Pros and cons abound in any method of making a printable eh? I like this one is all I know ;)

5 Apr 04, 2009 18:02

Makes sense, but you're still a step ahead of me:

1) Where does the code go that you just posted? In one of my skin files or somewhere else?

2) How can I get a "print me" link on the page, since so many people at this point probably expect that "File, Print" will get them a big mess? Also, I want the printable version to open in a separate window. Is that possible with the method we're talking about here?


6 Apr 04, 2009 18:07

1. The code I just posted doesn't go anywhere. It shows you what NOT to put in the file identified in THAT thread shows what to put and where to put it.

2. If you really want a printme link then you'll have to do a lot more work. I don't know how to do that. If you want it in a popup you'll have to craft that up yourself. I don't know how to do that. It'll be more work and I'm not into more work is the thing.

BTW I'm pretty sure there are quite a few threads about making a popup window for a printable version. Seems all of them kept coming back to some trouble or other with returning to the normal natural skin. They were quite a while ago though so perhaps those troubles are gone now? But I know nothing about it because it always seemed like killing flies with sledge-hammers. Eventually the fly dies but was it really worth the effort?

7 Apr 04, 2009 18:55

Sometimes it's just satisfying to see a sledgehammer hit a fly!

Thanks for your help.

I'll peruse that other thread and let you know if I come up with anything new.

Form is loading...

Run your own website! – This forum is powered by b2evolution CMS, a complete engine for your website.