[RC] Printer-friendly topic view mod

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Svyatozar
Registered User
Posts: 153
Joined: Fri Apr 12, 2002 5:38 am

Post by Svyatozar » Mon Sep 15, 2003 1:58 am

Hello there!

Bah, Thanh Binh where have you been? Now I see a man talking!
If you really want to make a mod to my mod - then go straight ahead. You may (re) use my code in any way you want in your mod. We'll see whose strategy will prove to be superior in terms of maintainability, and features that will be provided by the future releases of mods. You will see that your mod will have very few things in common with my mod, that's why I said: "it will require total remake of the mod"

To make the competition more or less even, you may not modify the viewtopic.php - because your whole idea is to have as few modifications as possible.

CyanBlue
Registered User
Posts: 409
Joined: Mon Jul 28, 2003 9:55 am

Post by CyanBlue » Mon Sep 15, 2003 2:00 am

:)

I know both sides have good and bad effects, but I prefer MODding existing file rather than dumping a new file into the directory...
Yes... It IS easy to just drop a new file for the MOD to work, but if I have 100 MODs that requires seperate files, then it means 100 extra files to keep track of especially if I make some modification to that extra file... Just my 2 cents... :)

Thanh Binh
Registered User
Posts: 16
Joined: Tue Sep 09, 2003 1:32 am

Post by Thanh Binh » Mon Sep 15, 2003 3:22 am

lol... no i am not competing if that is what you mean :)

NativeMind
Registered User
Posts: 45
Joined: Sun Apr 27, 2003 9:51 pm
Contact:

Post by NativeMind » Wed Sep 17, 2003 5:22 am

It's not like this mod will have a long life time, printing support will be in phpBB 2.2, so people can do what they want for a few months and then just load up phpbb2.2 :D

Svyatozar
Registered User
Posts: 153
Joined: Fri Apr 12, 2002 5:38 am

Post by Svyatozar » Wed Sep 17, 2003 1:43 pm

Well, I have something to contribute nevertheless. I have so many ideas to improve on this particular mod.

CyanBlue
Registered User
Posts: 409
Joined: Mon Jul 28, 2003 9:55 am

Post by CyanBlue » Wed Sep 17, 2003 5:46 pm

Svyatozar wrote: Well, I have something to contribute nevertheless. I have so many ideas to improve on this particular mod.

Can't wait to see those... :)

User avatar
Haywood Jahelpme
Registered User
Posts: 475
Joined: Wed Oct 23, 2002 9:16 am
Location: San Diego
Contact:

Post by Haywood Jahelpme » Wed Sep 17, 2003 5:51 pm

Svyatozar wrote: Well, I have something to contribute nevertheless. I have so many ideas to improve on this particular mod.
Yes, please contribute. Ignore those nay-sayers...

:wink:

Keep it up! We need this!

POilf
Registered User
Posts: 13
Joined: Mon Nov 05, 2001 7:44 am
Contact:

Post by POilf » Sun Sep 28, 2003 1:45 pm

Good news everyone ;-)

I installed your Mod with easyMod in 2.0.6

I had to edit your install.txt that all [FIND]'s are in the right order.
A diff should make clear what I mean...

This is what I've done:

Code: Select all

############################################################## 
## MOD Title: Printer-friendly topic output option 
## MOD Author: Svyatozar < svyatozar@pochtamt.ru >
## MOD Description: This mode will add a button with a printer
## Tested on phpBB versions 2.04-2.05, may work with others
## in the row (new topic) (reply) (printer). By pressing on
## that button the reader gets a printer-friendly view of the
## topic.
## See example at http://bbs.inglia.ru/viewtopic.php?t=1
##
## MOD Version: 1.0.2 (20030718), last fixed on 20030829
## UPGRADE: If you are upgrading from version 1.0.x go directly
##  to the bottom to the UPGRADES section.
## FRESH INSTALL: If you do not have version 1.0.x installed,
##  follow all the instruction up to the UPGRADES section.
## Check for a recent/updated version on http://phpbbhacks.com/
## 
## Installation Level: (easy), no tables/languages affected 
## Installation Time: 5 Minutes 
## Files To Edit:
##         templates/subSilver/subSilver.cfg
##         viewtopic.php
##         templates/subSilver/viewtopic_body.tpl 
## Included Files:
##         templates/subSilver/images/printer.gif
##         templates/subSilver/printer_header.tpl
##         templates/subSilver/printertopic_body.tpl
##         include/page_header_printer.php
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ 
############################################################## 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ COPY ]------------------------------------------ 
# 

copy printer.gif to templates/subSilver/images/printer.gif
copy printer_header.tpl to templates/subSilver/printer_header.tpl
copy printertopic_body.tpl to templates/subSilver/printertopic_body.tpl
copy page_header_printer.php to includes/page_header_printer.php

# 
#-----[ OPEN ]------------------------------------------ 
#
 
templates/subSilver/subSilver.cfg

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

$images['reply_locked'] = "$current_template_images/{LANG}/reply-locked.gif";

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

$images['printer'] = "$current_template_images/printer.gif";

# 
#-----[ OPEN ]------------------------------------------ 
#
 
viewtopic.php

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

	LIMIT $start, ".$board_config['posts_per_page'];

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

	LIMIT $start, ".(isset($HTTP_GET_VARS['msgcount']) & isset($HTTP_GET_VARS['printertopic']) ? intval($HTTP_GET_VARS['msgcount']) : $board_config['posts_per_page']);

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

//
// Post, reply and other URL generation for
// templating vars
//

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

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

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

$post_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'];

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

$printer_img = $images['printer'];
$printer_alt = "Printer-friendly version";

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

//
// Load templates
//
$template->set_filenames(array(
	'body' => 'viewtopic_body.tpl')
);
make_jumpbox('viewforum.'.$phpEx, $forum_id);

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

//
// Load templates
//
if(isset($HTTP_GET_VARS['printertopic']))
	$template->set_filenames(array(
		'body' => 'printertopic_body.tpl')
	);
else
	$template->set_filenames(array(
		'body' => 'viewtopic_body.tpl')
	);
make_jumpbox('viewforum.'.$phpEx, $forum_id);

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

//
// Output page header
// 
$page_title = $lang['View_topic'] .' - ' . $topic_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

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

//
// Output page header
//
$page_title = $lang['View_topic'] .' - ' . $topic_title;
if(isset($HTTP_GET_VARS['printertopic']))
	include($phpbb_root_path . 'includes/page_header_printer.'.$phpEx);
else
	include($phpbb_root_path . 'includes/page_header.'.$phpEx);

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

$pagination = ( $highlight != '' ) ? 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);

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

if(isset($HTTP_GET_VARS['printertopic'])) {
	$pagination = ( $highlight != '' )? generate_pagination("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight". (isset($HTTP_GET_VARS['msgcount'])? "&msgcount=". intval($HTTP_GET_VARS['msgcount']): ''), $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start): generate_pagination("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order". (isset($HTTP_GET_VARS['msgcount'])? "&msgcount=". intval($HTTP_GET_VARS['msgcount']): ''), $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start);
	if($pagination != '')
		$pagination = $pagination. (( $highlight != '' )? " &<a href=\"viewtopic.$phpEx?printertopic=1&". POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight&start=0&msgcount=10000\" title=\"no pagination\">:||:</a>":  " &<a href=\"viewtopic.$phpEx?printertopic=1&". POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&start=0&msgcount=10000\" title=\"no pagination\">:||:</a>");
	}
else
	$pagination = ( $highlight != '' )? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start): generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start);

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

	'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / intval($board_config['posts_per_page']) ) + 1 ), ceil( $total_replies / intval($board_config['posts_per_page']) )),

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

	'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / intval((isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page'])) ) + 1 ), ceil( $total_replies / intval((isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page'])) )),

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

	'REPLY_IMG' => $reply_img,

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

	'PRINTER_IMG' => $printer_img,
	
# 
#-----[ FIND ]------------------------------------------ 
#

	'L_POST_REPLY_TOPIC' => $reply_alt, 

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

	'L_PRINTER_TOPIC' => $printer_alt, 

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

	'U_POST_NEW_TOPIC' => $new_topic_url,

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

	'U_PRINTER_TOPIC' => $printer_topic_url,
	
# 
#-----[ FIND ]------------------------------------------ 
#

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

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

if(isset($HTTP_GET_VARS['printertopic']))
	$gen_simple_header = 1;
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

# 
#-----[ 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 ]------------------------------------------ 
# 
# EoM
(sorry for "fullquote" your file, but the changes are almost over the whole file. I'm also sorry for my awfull english, but i'm tired and drunk ;-))

POilf
Registered User
Posts: 13
Joined: Mon Nov 05, 2001 7:44 am
Contact:

Post by POilf » Sun Sep 28, 2003 1:48 pm

if you have questions, mailto: poilf+phpbb.com_print_view_mod@alte-sauna.net

Svyatozar
Registered User
Posts: 153
Joined: Fri Apr 12, 2002 5:38 am

Post by Svyatozar » Mon Sep 29, 2003 2:17 pm

Thanks for help. I will update the latest version and hopefully finally release the mod.

Does anyone have an idea of how to make alternative text for printer button that would not need to be translated? I don't want to mess with language files...

Have fun!

POilf
Registered User
Posts: 13
Joined: Mon Nov 05, 2001 7:44 am
Contact:

Post by POilf » Mon Sep 29, 2003 3:22 pm

you can use esperanto ;-)

I think it's not that difficult to "mess with the language files":

Code: Select all

#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
//-- mod : merge -----------------------------------------------------------------------------------
//-- add
$lang['Refresh'] = 'Refresh';
$lang['Merge_topics'] = 'Merge topics';
$lang['Merge_title'] = 'New topic title';
[..]
$lang['Merge_topic_done'] = 'The topics have been successfully merged.';
this is from the mod simply merge, this line is easymod compatible. easymod will add the language vars to all languages that are installed in phpBB2

Svyatozar
Registered User
Posts: 153
Joined: Fri Apr 12, 2002 5:38 am

Post by Svyatozar » Sun Oct 05, 2003 7:22 am

A version that seems to be working with easymod is now ready. Since easymod does not uninstall yet, I do not recommend to install it directly on the server. For those impatient testers who want to see new features of the mod (listed in the changelog in the install.txt) here's the link:
http://wiking.sourceforge.net/phpBB2/pr ... _1.0.6.zip
Have fun!

POilf
Registered User
Posts: 13
Joined: Mon Nov 05, 2001 7:44 am
Contact:

Post by POilf » Mon Oct 06, 2003 12:27 am

Hey, my first credits in a release-note ever!

thx :-)

brasco
Registered User
Posts: 28
Joined: Tue Apr 23, 2002 12:22 am
Contact:

Post by brasco » Sun Oct 12, 2003 9:49 pm

Great mod, really like the no pagination option aswell

Printers everywhere will be getting a good test with this one :)
Image
--------------------------------------------
http://www.security-forums.com

mbressman
Registered User
Posts: 49
Joined: Tue Sep 02, 2003 1:55 pm
Location: NJ/NYC
Contact:

Question about editing viewtopic.php

Post by mbressman » Thu Oct 16, 2003 6:06 pm

The following is part of the install.txt file for installing this mod (the file being edited is viewtopic.php):

Code: Select all

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

$pagination = ( $highlight != '' ) ? 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);

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

if(isset($HTTP_GET_VARS['printertopic'])) {
	$pagination = ( $highlight != '' )? generate_pagination("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight". (isset($HTTP_GET_VARS['msgcount'])? "&msgcount=". intval($HTTP_GET_VARS['msgcount']): ''), $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start): generate_pagination("viewtopic.$phpEx?printertopic=1&" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order". (isset($HTTP_GET_VARS['msgcount'])? "&msgcount=". intval($HTTP_GET_VARS['msgcount']): ''), $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start);
	if($pagination != '')
		$pagination = $pagination. (( $highlight != '' )? " &<a href=\"viewtopic.$phpEx?printertopic=1&". POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight&start=0&msgcount=10000\" title=\"no pagination\">:||:</a>":  " &<a href=\"viewtopic.$phpEx?printertopic=1&". POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&start=0&msgcount=10000\" title=\"no pagination\">:||:</a>");
	}
else
	$pagination = ( $highlight != '' )? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start): generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, (isset($HTTP_GET_VARS['msgcount'])? intval($HTTP_GET_VARS['msgcount']): $board_config['posts_per_page']), $start);
However, in my phpBB, the following code doesn't exist:

Code: Select all

( $highlight != '' )
Instead, this exists:

Code: Select all

( $highlight_active )
So, I just replaced the former code with the latter code and everything seems to be working alright, but I'm wondering what the difference in the code is and if my replacing the former with the latter in viewtopic.php is going to break anything else?

Any help is greatly appreciated! Thanks!

Locked

Return to “[2.0.x] MODs in Development”