Code: Select all
##############################################################
## MOD Title: Category Crumb Trail
## MOD Author: Jimi D < [email protected] > (Jim Einarson) N/A
## MOD Description: Adds the Category Title and a link back to the Index page with category-specific query
## to the Crumb Trail at page top and bottom...
## MOD Version: 0.9.2b
##
## Installation Level: Easy
## Installation Time: 10 Minutes
## Files To Edit: viewforum.php, viewtopic.php, viewforum_body.tpl, viewtopic_body.tpl, posting.php, posting_body.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/
##############################################################
## Author Notes: Category in crumb trail mod... This modification puts the category title in the crumb trail that
## builds at the top and bottom of the page as you drill down into the forums to read specific posts, and creates
## a link back to the Index page with the category specified in the query string. It works best in tandem with
## Adrian Cockburn's excellent Cat Index Alternative (CIA) Mod, but it can be used alone.
##############################################################
## MOD History:
##
## 2003-09-28 - Version 0.9.2b
## - improved the SQL syntax and integration to include the required queries in a given page script's
## original SQL statement(s) where possible (involved changes to the code on all *.php pages)
## - improved/clarified the MOD instructions in the template, adding commented code where reasonable
## 2003-09-22 - Version 0.9.0b
## - works on my deployment of phpBB 2.0.6 but was developed for use in-house... No obvious
## bugs but I don't know how the SQL will hold up under heavy use... caveat emptor :-)
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
viewforum.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
#
#-----[ REPLACE WITH ]------------------------------------
#
// original SQL before Category Title mod
/* $sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
*/
//
// Category Title in Crumb Trail mod...
//
$sql = "SELECT f.* , c.cat_title
FROM " . FORUMS_TABLE . " f , " . CATEGORIES_TABLE . " c
WHERE forum_id = $forum_id AND f.cat_id = c.cat_id";
//
// End of Category Title in Crumb Trail mod
//
#
#-----[ FIND ]------------------------------------------
#
'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],
#
#-----[ AFTER, ADD ]------------------------------------
#
// Category Title in Crumb Trail Mod...
'CATEGORY_NAME' => $forum_row['cat_title'],
// End of Category Title in Crumb Trail Mod
#
#-----[ FIND ]------------------------------------------
#
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
#
#-----[ AFTER, ADD ]------------------------------------
#
// Category Title in Crumb Trail Mod...
'U_VIEW_CATEGORY' => append_sid("index.$phpEx?c=" . $forum_row['cat_id']),
// End of Category Title in Crumb Trail Mod
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
#
#-----[ REPLACE WITH ]----------------------------------
#
// original SQL before Category Title mod
/* $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
$order_sql";
*/
//
// Category Title in Crumb Trail mod...
//
$sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, c.cat_title, f.forum_name, f.forum_status, f.forum_id, f.cat_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
FROM " . TOPICS_TABLE . " t, " . CATEGORIES_TABLE. " c," . FORUMS_TABLE . " f" . $join_sql_table . "
WHERE $join_sql
AND f.forum_id = t.forum_id
AND f.cat_id = c.cat_id
$order_sql";
//
// End of Category Title in Crumb Trail mod
//
#
#-----[ FIND ]------------------------------------------
#
$forum_id = intval($forum_topic_data['forum_id']);
#
#-----[ AFTER, ADD ]----------------------------
#
// Category Title in Crumb Trail Mod...
$cat_id = intval($forum_topic_data['cat_id']);
$cat_name = $forum_topic_data['cat_title'];
// End of Category Title in Crumb Trail Mod
#
#-----[ 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']) )),
#
#-----[ AFTER, ADD ]------------------------------------
#
// Category Title in Crumb Trail Mod...
'CATEGORY_NAME' => $cat_name,
// End of Category Title in Crumb Trail Mod
#
#-----[ FIND ]------------------------------------------
#
'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=$highlight"),
#
#-----[ BEFORE, ADD ]------------------------------------
#
// Category Title in Crumb Trail Mod...
'U_VIEW_CATEGORY' => append_sid("index.$phpEx?c=$cat_id"),
// End of Category Title in Crumb Trail Mod
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
#
#-----[ REPLACE WITH ]----------------------------
#
// original SQL before Category Title mod
/* $sql = "SELECT *
FROM " . FORUMS_TABLE . "
WHERE forum_id = $forum_id";
*/
//
// Category Title in Crumb Trail mod...
//
$sql = "SELECT f.* , c.cat_title
FROM " . FORUMS_TABLE . " f , " . CATEGORIES_TABLE . " c
WHERE forum_id = $forum_id AND f.cat_id = c.cat_id";
//
// End of Category Title in Crumb Trail mod
//
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT f.*, t.topic_status, t.topic_title
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
#
#-----[ REPLACE WITH ]----------------------------
#
// original SQL before Category Title mod
/* $sql = "SELECT f.*, t.topic_status, t.topic_title
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
*/
//
// Category Title in Crumb Trail mod...
//
$sql = "SELECT f.*, c.cat_title, t.topic_status, t.topic_title
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id
AND f.cat_id = c.cat_id";
//
// End of Category Title in Crumb Trail mod
//
#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
$where_sql";
#
#-----[ REPLACE WITH ]----------------------------
#
// original SQL before Category Title mod
/* $sql = "SELECT f.*, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $from_sql . "
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
$where_sql";
*/
//
// Category Title in Crumb Trail mod...
//
$sql = "SELECT f.*, c.cat_title, t.topic_id, t.topic_status, t.topic_type, t.topic_first_post_id, t.topic_last_post_id, t.topic_vote, p.post_id, p.poster_id" . $select_sql . "
FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " .CATEGORIES_TABLE. " c, " . FORUMS_TABLE . " f" . $from_sql . "
WHERE p.post_id = $post_id
AND t.topic_id = p.topic_id
AND f.forum_id = p.forum_id
AND f.cat_id = c.cat_id
$where_sql";
//
// End of Category Title in Crumb Trail mod
//
#
#-----[ FIND ]------------------------------------------
#
$forum_id = $post_info['forum_id'];
$forum_name = $post_info['forum_name'];
#
#-----[ AFTER, ADD ]----------------------------
#
// Category Title in Crumb Trail Mod...
$cat_id = intval($post_info['cat_id']);
$cat_name = $post_info['cat_title'];
// End of Category Title in Crumb Trail Mod
#
#-----[ FIND ]------------------------------------------
#
$template->assign_vars(array(
'FORUM_NAME' => $forum_name,
#
#-----[ AFTER, ADD ]----------------------------
#
// Category Title in Crumb Trail Mod...
'CATEGORY_NAME' => $cat_name,
// End of Category Title in Crumb Trail Mod
#
#-----[ FIND ]------------------------------------------
#
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
#
#-----[ BEFORE, ADD ]----------------------------
#
// Category Title in Crumb Trail Mod...
'U_VIEW_CATEGORY' => append_sid("index.$phpEx?c=$cat_id"),
// End of Category Title in Crumb Trail Mod
#
#-----[ OPEN ]------------------------------------------
#
viewforum_body.tpl
#
#-----[ FIND ]------------------------------------------
# NOTE: THERE ARE TWO OF THESE ROWS, one at the top of the page and one at the bottom...
<td align="left" valign="middle" class="nav" ><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a> -> <a class="nav" href="{U_VIEW_FORUM}">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE FIND ]----------------------------------
#
<a href="{U_INDEX}" class="nav">{L_INDEX}</a> ->
#
#-----[ IN-LINE AFTER, ADD ]----------------------------
#
<a class="nav" href="{U_VIEW_CATEGORY}">{CATEGORY_NAME}</a> ->
#
#-----[ OPEN ]------------------------------------------
#
viewtopic_body.tpl
#
#-----[ FIND ]------------------------------------------
# NOTE: THERE ARE TWO OF THESE ROWS, one at the top of the page and one at the bottom...
<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>
#
#-----[ IN-LINE FIND ]----------------------------------
#
-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE BEFORE, ADD ]----------------------------
#
-> <a class="nav" href="{U_VIEW_CATEGORY}">{CATEGORY_NAME}</a>
#
#-----[ OPEN ]------------------------------------------
#
posting_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<!-- BEGIN switch_not_privmsg -->
-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
<!-- END switch_not_privmsg -->
#
#-----[ IN-LINE FIND ]----------------------------------
#
-> <a href="{U_VIEW_FORUM}" class="nav">{FORUM_NAME}</a></span></td>
#
#-----[ IN-LINE BEFORE, ADD ]----------------------------
#
-> <a class="nav" href="{U_VIEW_CATEGORY}">{CATEGORY_NAME}</a>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Will do Eric... It never occured to me that using REPLACE WITH would mess up other people's mods (silly bunt! 8O )... I guess I'll have to change all the seperators in the crumb trail? The "->" seperator between the index and forum is the the bog-standard in subSilver, and that's why I'm using it - I guess we could change them all to ">>" or something, or would it be better if I just escape them in the html? Thanks for the input...wGEric wrote: Before you submit it, I have some things that you need to fix.
First off, could you use INLINE commands instead of all of those REPLACE WITHs? We will probably deny it if you leave it how you do now. Other MODs might edit those lines so using INLINEs won't affect the other MODS like replacing will.
Second, you need to get rid of all the --> They look like they aren't part of the code so EasyMOD will choke on those FINDs.
Jimi D wrote: I guess I'll have to change all the seperators in the crumb trail? The "->" seperator between the index and forum is the the bog-standard in subSilver, and that's why I'm using it - I guess we could change them all to ">>" or something, or would it be better if I just escape them in the html? Thanks for the input...
Code: Select all
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
$order_sql = ( empty($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
#
#-----[ REPLACE WITH ]------------------------------------------
#
$order_sql = ( empty($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments, f.cat_id, c.cat_title ORDER BY p.post_id ASC";
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM