Page 1 of 6

[RC] Printer-friendly topic view mod

Posted: Thu Jan 23, 2003 9:32 pm
by Svyatozar
Welcome!

Download the most recent version of printer-friendly mod, v 1.0.6:
http://wiking.sourceforge.net/phpBB2/pr ... _1.0.6.zip

Printer-friendly topic mod for versions 2.0.4/2.0.6 of phpBB adds a printer button on the topic view page, which leads to a lightweight view of the topic, which is more suitable for printing.

Since Monday, October 3, this is an officially released mode. This thread will probably be locked soon, so here is the new support thread for this mod:
http://www.phpbb.com/phpBB/viewtopic.php?t=141443

October 17, 2003: A new version of this mod is out!
I invite you to preview it on my demo site
(just press on the printer there):
:arrow: http://bbs.inglia.ru/viewtopic.php?t=1
Pagination demo:
:arrow: http://bbs.inglia.ru/viewtopic.php?t=1& ... msgcount=4

Latest released version is 1.0.6

Recently added features in the latest version 1.0.6 include:
- this mod is now 100% easymod-friendly
- reader can now specify starting message number and either last message number or number of messages to print. In the latter case the second number must be negative
- code is reorganized
- bug fixes

Changelog
1.0.1 - 1.0.2:
- an option to view whole topic without pagination. This is made possible by introducing an HTTP_GET_VAR named msgcount, which valure overrides the default board's messages-per-page value, but only in the printer-friendly output mode.
- the printer button is now language-independent
- it is now possible to go from one page to another while staying in printer-friendly mode
- somewhat less ambiguous way of separating messages on the output


1.0.0 - 1.0.1:
- now pages beyond page 1 can be printed as well
- no more signatures in the printer view
- polls results are always printed for all polls


See also: http://phpbbhacks.com/viewhack.php?id=1004 (may be not up-to-date).

For your convenience, here is a link to the section of this topic related to the last updated version of this message:
http://www.phpbb.com/phpBB/viewtopic.ph ... c&start=77

Posted: Tue Jan 28, 2003 2:14 am
by Svyatozar

Posted: Sat Feb 01, 2003 5:28 pm
by jlin
Hi,

the printer friendly mod doesn't print the 2nd, 3rd, 4th, etc... page

Posted: Sun Feb 02, 2003 4:14 am
by Svyatozar
Thanks for reporting that bug.
Here's a quick fix:

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 

viewtopic.php 

# 
#-----[ FIND ]------------------------------------------ 
# 

$printer_topic_url = append_sid("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id"); 

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

$printer_topic_url = append_sid("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&vote=viewresult"); 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
I will make a bugfix release shortly which will include this bug fix as well.
Good luck!

Posted: Mon Feb 03, 2003 6:33 am
by Svyatozar
Version 1.0.1 released, d/load address is the same. It includes all the bug fixes to all bugs known at this moment. For upgrade information see the bottom of the install.txt file.
Please, report any bugs right away.

Have fun!

Posted: Sun Mar 23, 2003 5:12 pm
by leander

Code: Select all

#-----[ OPEN ]------------------------------------------ 
# 

templates/subSilver/viewtopic_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&&&<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&&&<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
  </tr>
</table>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&&&<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a>&&&<a href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&&&<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
  </tr>
</table>

# 
#-----[ FIND ]------------------------------------------ 
#

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  <tr> 
	<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&&&<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&&&<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
	<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span> 
	  </td>
  </tr>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
  <tr> 
	<td align="left" valign="middle" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&&&<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a>&&&<a href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&&&<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
	<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span> 
	  </td>
  </tr>

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
The last thing you're asked to replace does not exist. Not even in a new fresh viewtopic_body.tpl file.

The line:

Code: Select all

<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span> 
only occurs once in the file, and the code around it is:

Code: Select all

<table width="100%" cellspacing="2" cellpadding="2" border="0">
  <tr> 
	<td align="left" valign="bottom" nowrap="nowrap"><span class="nav"><a href="{U_POST_NEW_TOPIC}"><img src="{POST_IMG}" border="0" alt="{L_POST_NEW_TOPIC}" align="middle" /></a>&&&<a href="{U_POST_REPLY_TOPIC}"><img src="{REPLY_IMG}" border="0" alt="{L_POST_REPLY_TOPIC}" align="middle" /></a>&&&<a href="{U_PRINTER_TOPIC}"><img src="{PRINTER_IMG}" border="0" alt="{L_PRINTER_TOPIC}" align="middle" /></a></span></td>
	<td align="left" valign="middle" width="100%"><span class="nav">&&&<a href="{U_INDEX}" class="nav">{L_INDEX}</a> 
	  -> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
  </tr>
</table>
	<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span></td>
  </tr>
  <tr>
	<td align="left" colspan="3"><span class="nav">{PAGE_NUMBER}</span></td>
  </tr>
</table>
The code at the top here is the area that I've already replaced. So you see that there is nothing left to replace that consist the line:

Code: Select all

<td align="right" valign="top" nowrap="nowrap"><span class="gensmall">{S_TIMEZONE}</span><br /><span class="nav">{PAGINATION}</span>

Posted: Thu Mar 27, 2003 3:31 am
by Svyatozar
Sorry for such a late response.

First of all, IF you are upgrading from a previous version you only should read the upgrade info in the bottom of that text file.

Anyway, what we are doing in that file viewtopic_body.tpl, is basically adding the Printer buttons to the page. We add one in the top and one in the bottom.

I understand that your version of phpBB might be already modded with another mod, so you should look for similar places. I suggest using WinMerge or a better dif utility to compare files - that may become the only way to mode the highly-modded versions of phpBB. This mod presumes that you apply it to a plain (vanilla) version of phpBB.

Please, tell me if my answer is satisfying. I hope that this info will be helpful.

Svyatozar

Print all pages

Posted: Tue Apr 01, 2003 3:40 am
by tealnet
Is there a way that it could be instructed to print all pages at once?

Printer Friendly Pagination

Posted: Wed Apr 23, 2003 1:08 pm
by Remix_88
Hi,

Thanks for the Mod, I have integrated it in to my forum. However, I noticed that when viewing the printer friendly pages, the pagination links pointed to the regular 'viewtopic.php' rather than 'viewtopic.php?printertopic=1'.

I reckon that once someone is viewing the printer friendly page they want it to stay that way until they close it? Here are the modifications which will add printer friendly pagination links to this mod.

Code: Select all

#-----[ OPEN ]------------------------------------------ 
# 

/viewtopic.php

#-----[ FIND ]------------------------------------------ 
# 

$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);

#-----[ ADD, AFTER ]------------------------------------------ 
# 

$print_pagination = generate_pagination("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult", $total_replies, $board_config['posts_per_page'], $start);

#-----[ FIND ]------------------------------------------ 
# 

'PAGINATION' => $pagination,

#-----[ ADD, AFTER ]------------------------------------------ 
# 

'PRINT_PAGINATION' => $print_pagination,

#-----[ OPEN ]------------------------------------------ 
# 

/templates/subSilver/printertopic_body.tpl

#-----[ FIND ALL]------------------------------------------ 
#

{PAGINATION}

#-----[ REPLACE WITH]------------------------------------------ 
#

{PRINT_PAGINATION}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------

Posted: Fri Apr 25, 2003 8:04 pm
by captain alban
Good idea for a MOD.

I think there is an typo in your install.txt

Code: Select all

##         templates/subSilver/printer_header.tpl
##         templates/subSilver/printer_header.tpl
should be :

Code: Select all

##         templates/subSilver/printer_header.tpl
##         templates/subSilver/printertopic_body.tpl
Then, I think you should have a look at your code regarding the link to the forum homepage that is put at the beginning of the "printed" page. It does not seem to handle forum homepages that are not at the root.
My forum homepage is http://www.captain-alban.net/forums/index.php
but your code points to http://www.captain-alban.net/index.php
(before you ask, yes, my forum is set correctly).

You should put your printer.gif in the images/lang_xxx
with the code :

Code: Select all

$images['printer'] = "$current_template_images/{LANG}/printer.gif";
Then, you can add "local" printer.gif. I found a French one on
http://www.forumimages.com/

I think tealnet's idea of being able to print all the post at once is a good idea. In fact I was expecting the mode to do this, not to keep the pagination.
You should propose this, at least as an option.

Then, I agree also with Remix_88. This is definitely how it should work. I will try his code later.

Hope it helps.

Posted: Fri Apr 25, 2003 8:08 pm
by captain alban
captain alban wrote: Then, I think you should have a look at your code regarding the link to the forum homepage that is put at the beginning of the "printed" page. It does not seem to handle forum homepages that are not at the root.
My forum homepage is http://www.captain-alban.net/forums/index.php
but your code points to http://www.captain-alban.net/index.php
(before you ask, yes, my forum is set correctly).

It may come from here :

Code: Select all

	'U_INDEX' => append_sid('../index.'.$phpEx),
You'd rather set an absolute URL (using the forum settings) than a relative one.

Posted: Mon Apr 28, 2003 12:26 am
by Svyatozar
I will update the mod with all the good stuff, I promise.

All the best!

-Svyatozar

Posted: Fri May 30, 2003 11:38 pm
by Svyatozar
Please, do not mind the button internalization issue. Im going to change the design in the next version of the mod so there will be no text on the buttons that will come with it!

All the best!

Svyatozar

Posted: Tue Jul 08, 2003 4:56 pm
by Svyatozar
Hello!

I invite you to check out the preview of the upcoming version of the mod (version 1.0.2), which is to be released this week if everything goes well.

Here is the demo page:
http://bbs.inglia.ru/viewtopic.php?t=1
Because there is not many pages in that topic you can use this link to test pagination:
http://bbs.inglia.ru/viewtopic.php?t=1& ... msgcount=4

I thank you for all the previous suggestions, which I did implement into upcoming release, as I promised. Please, report any further bugs/suggestions here, in this forum.

Regards,

Svyatozar

Posted: Fri Jul 18, 2003 8:46 pm
by Svyatozar
Hello!

Version 1.0.2 of the mod is out!

You can download it from same old location:
http://wiking.sourceforge.net/phpBB2/pr ... opic_1.zip

Remember to backup all files before modifying them.

Please, report any bugs/suggestions.

Have fun!