############################################################## ## MOD Title: Post Exerpt ## MOD Author: Goxu < goxu@dowonders.net > ## MOD Description: Excerpts first posts and display them in the forum index. If there is an image posted, the first one will be displayed in the forum index as a thumbnail. ## MOD Version: 1.1.0 ## ## Installation Level: (Easy) ## Installation Time: 5 Minutes ## Files To Edit: viewforum.php ## templates/subSilver/viewforum_body.tpl ## Included Files: (n/a) ############################################################## ## Author Notes: My First mod :) Great Thanks to dESiLVer, who created the Mouse Hover Last Post. ## This mod is just a little sister of that mod. ## ## ## In order to change the excerpt length, just edit the $char_limit = '380'; to whatever number you want. ############################################################## ## MOD History: ## ## 2006-10-15 - Version 1.0.0 ## 2006-10-18 - Version 1.1.0 :picture preview is avalable ## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------ # viewforum.php # #-----[ FIND ]----------------------------------- # $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; # #-----[ AFTER, ADD ]------------------------------------------- # $sql = "SELECT post_text FROM " . POSTS_TEXT_TABLE . " WHERE post_id=" . $topic_rowset[$i]['topic_first_post_id']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $imagepreview = ""; $excerpt_post = $row['post_text']; if(preg_match("#\[url=(.+)\]\[img:(.+)\](.+)\[/img(.+)\]\[/url\]#", $excerpt_post, $matches)){ $imagepreview = "\"$matches[1]\""; } $char_limit = '500'; if (strlen($excerpt_post) > $char_limit) { $excerpt_post=substr($excerpt_post, 0, $char_limit) . "...."; } $excerpt_post = preg_replace("/\[.+\]/iU",'',$excerpt_post); $excerpt_post = str_replace(array('"', '\''), array('"e;', '\\\''), $excerpt_post); # # #-----[ FIND ]----------------------------------- # 'LAST_POST_TIME' => $last_post_time, # #-----[ AFTER, ADD ]------------------------------------------- # 'EXCERPT_POST' => $excerpt_post, 'IMAGE_PREVIEW' => $imagepreview, # #-----[ OPEN ]------------------------------ # templates/subSilver/viewforum_body.tpl # #-----[ FIND ]----------------------------------- # {topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}{topicrow.TOPIC_TITLE}
# # #-----[ IN-LINE FIND ]----------------------------------- # {topicrow.TOPIC_TYPE} # #-----[ IN-LINE AFTER, ADD ]------------------------------------------- # {topicrow.IMAGE_PREVIEW} # # #-----[ IN-LINE FIND ]----------------------------------- # {topicrow.TOPIC_TITLE}
# #-----[ IN-LINE AFTER, ADD ]------------------------------------------- #
{topicrow.EXCERPT_POST} # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # That's it! :)