Topic: A printer-friendly version of threads.

A seperate parser that optimises the page for printing/saving is basically what I mean. I have checked punres for a similar mod but I couldn't find one, so yea.

Re: A printer-friendly version of threads.

Normally, you don't need one. It's a CSS job (mostly), and the 1.2 branch arleady has this (try a preview print on this board to see it).

Re: A printer-friendly version of threads.

And 1.3 has a specific print stylesheet wink

Re: A printer-friendly version of threads.

That's even better smile

And since we are on the feature request forum : it would be nice to have a conditionnal printed stylesheet, because half the world use A4, when the other half use Letter.

5

Re: A printer-friendly version of threads.

And the half of the world that uses A4 cannot agree on the size of A4. I think catering for different paper sizes if probably overkill though.

Re: A printer-friendly version of threads.

Uh? First time I heard about this...

A4 is defined in ISO 216, as 210×297 mm. It's the size I've always seen from several countries.

Re: A printer-friendly version of threads.

jeremie, i checked the print preview of this exact page and it didnt show any diferences betwin the normal view, expet for the background remove which is a browser setting.

Thats actually a cool mode. I will chack out if i can do something, but it will take time.

In case somebody starts to write a module for a print version allow me to drop an advice: remove all vertical lines, dont wrap content in a box, the vertical lines really slow down the inkjet printers.

Just before i start anything... let me put my ideas together and please tell me if i am missing something.

So i would need to:
*place a "print this topic" link on viewtopic.php
*include comon.php
*check if the current user has read permitions ( i can use the same checking procedure as in viewtopic.php )
*remove the pagination from the sql
*output it

Is anybody avaluable to write the html/css? my skills on that are poor.

Re: A printer-friendly version of threads.

pedrotuga, why not just use CSS?

See also: http://www.alistapart.com/articles/goingtoprint/

Re: A printer-friendly version of threads.

guardian34 wrote:

pedrotuga, why not just use CSS?

See also: http://www.alistapart.com/articles/goingtoprint/

because the page content should not be the same. If i want to print a topic with 4 pages it doesnt make sense to print page by page.

Re: A printer-friendly version of threads.

That's actually a good point. So maybe not a "print" function, but a "see the whole thread" function ; that could be use for all kind of things.

Re: A printer-friendly version of threads.

Extensions, extensions, extensions smile

Re: A printer-friendly version of threads.

Trac public login, trac public login, trac public login tongue

Re: A printer-friendly version of threads.

This is offtopic, but getting that set up properly is more difficult than it would seem wink

Re: A printer-friendly version of threads.

I must confess i didnt understand your last posts smartyes and jeremie.

Anyway... jeremie, i dont think a "show full thread" function  would be practical for anything else than a print view.

Smartys, how dificult would it be and why? can you be more speciffic?

15 (edited by guardian34 2007-01-09 05:33)

Re: A printer-friendly version of threads.

Jérémie is talking about non-developers getting logins for the PunBB Trac; Smartys is talking about integrating the login info for Trac and this forum.

Edit:

pedrotuga wrote:

because the page content should not be the same. If i want to print a topic with 4 pages it doesnt make sense to print page by page.

So why not use Jérémie's "see whole topic" idea with CSS and let the user decide what to do with the content. All you really need to do is provide a way to not paginate the posts in a topic.

Re: A printer-friendly version of threads.

mmm ok, i see, it was ot.

guardian, i dont see any use of showing a page with 60 messages normaly styled. Then also in a print version is not only the layout that changes, it's also the content,a nd it changes a lot in fact.
I made up mind mind on this, sorry. It will be a printable version mod

Re: A printer-friendly version of threads.

Two other uses, right off the hat:

1. Easy save/archive thing
2. Easy local search (when you have a 1K or 2K posts thread, remember a word/a sentence in it but don't remember when; it happens to me all the time).

18

Re: A printer-friendly version of threads.

The other place that paginated threads are a pain is when extracting the thread as an hatom microformat. Each page ends up as a seperate feed. However, a show whole thread option wouldn't get around that one, it would have to be the default with pagination as the option.

Re: A printer-friendly version of threads.

pedrotuga wrote:

it's also the content,a nd it changes a lot in fact.

I'm not so sure about this, but I think you should be able to copy viewtopic.php and change the content it produces (unpaginated, etc.).

Re: A printer-friendly version of threads.

I don't remember where I found it, either here or PunRes, but there is a mod for printer friendly.

See it in action here

Re: A printer-friendly version of threads.

soonotes, thank you!
Looks like we dont need to work on this big_smile

i will look for it

Re: A printer-friendly version of threads.

Found it. http://www.punres.org/files.php?pid=145

I know I changed a couple of things for the style and if I remember right you have to make a change in viewprintable to prevent users from viewing a printable version of a topic they shouldn't have access to. I'll check on that.

Re: A printer-friendly version of threads.

Yep, i already dload and install it.
Really cool.

Snootes... it's true, you need to add user autenticity. Since you already did that, would it be ok to post your code?

Re: A printer-friendly version of threads.

There are a few things you won't need for this page, but it looks like you should be able to copy from viewtopic.php.

In viewprintable.php, try finding?

$result = $db->query('SELECT t.subject, t.num_replies, f.id AS forum_id, f.forum_name, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.id='.$id) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

?replacing with:

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

Re: A printer-friendly version of threads.

That's exactly what I did for authentication. Also, instead of adding the printable link to header I put it right in viewtopic like this

http://www.soonotes.com/bbs/img/post/prnt.jpg

Personal preference I guess but I thought it was better there. If you want to do that open viewtopic.php and around line 171

        <p class="postlink conr"><?php echo $post_link ?></p>

Replace with

        <p class="postlink conr"><?php echo $post_link ?><br /><a href="viewprintable.php?id=<?php echo $id ?>"><?php echo $lang_common['Print version'] ?></a></p>