Inque187 Posted April 30, 2005 Share Posted April 30, 2005 I didn't know if this was classified as a "full" modification, so I posted here. Please forgive me if it is posted in the wrong place.SSI News, Sentence Trim Mod For those folks who are not using the IPB Portal for IPB boards and would still like to show the topics from your "News" forum on a selected page (on main portal) on your website "but" don't want the entire post to be listed on that page - I have hammered out a solution. I myself used the SSI.php file and SSI templates to show the news forum topics on my clan gaming webpage but was a bit dismayed at the inability to "not show the entire post" on the page. With the current SSI setup for showing news topics, it would show the entire post on the page you wanted whether the post was short or incredibly long. Well that just wasn't to clean looking for my tastes, so I set upon a mission to be able to "trim" the posts to a certain word length. Before anyone say anything; I am just learning the basics of PHP scripting. After a cry for help over at the http://forums.devshed.com forums - I came up with an easy work around. First, you must have the SSI.php and NEWS.html files correctly installed on your forums. It is recommended that you read the SSI.php file for help notes on how to add this mod to your forums and website. You may edit the News.html file according to how you want the News Topics to show on your selected page. But the main modifications will go in the SSI.php file. Now let's get to work. - Open the SSI.php file in a text or html editor - Find/search for this line of text in the SSI.php file: $row['post'] = $parser->post_db_parse( $row['post'] ); - Right below it add this set of coding: //-------------------------------------------------------------------- //----- Begin SSI News, Sentence Trim Mod //-------------------------------------------------------------------- $news_posts = $row['post']; $postlength = 125; // Adjust to fit your webpage or TABLE space $words = explode(' ', $news_posts); if (count($words) > $postlength) { $news_posts = implode(' ', array_slice($words, 0, $postlength))."... <A TARGET=_blank HREF="$ibforums->base_url?act=ST&f={$row['forum_id']}&t={$row['tid']}" ONMOUSEOVER="status='View Topic: {$row['title']}';return true" TITLE="View Topic: {$row['title']}"><B>Read More</B></A>"; } else { if (count($words) <= $postlength) { $news_posts = implode(' ', array_slice($words, 0)); } } //-------------------------------------------------------------------- //----- End SSI News, Sentence Trim Mod //-------------------------------------------------------------------- - Change the value of $postlength to however many words you want the post to be cut off at. You will need to experiment with different lengths in order to match your webpage - Now find/search for this line of text in the SSI.php file: 'post' => $row['post'], - Replace with this line of coding: 'post' => $news_posts, - Save the SSI.php file and upload to the "root" directory of your forums. - Make sure your also upload the NEWS.html file to the "ssi_templates" folder under your forums directory - add this line of coding to whichever webpage you want your news topics to appear on: <?PHP error_reporting(0); include("http://domain.com/forums/ssi.php?a=news&show=5"); ?> and Voila! Your news forum topics now appear and they are trimmed to the word length you have chosen. Please see example: http://www.fbi-clan.org (middle column) This mod can also be applied to the IPB Portal template but has not been tested. Link to comment Share on other sites More sharing options...
Dlf Posted May 1, 2005 Share Posted May 1, 2005 RSS / SSI overhaul IPB Portal overhaulhttp://www.invisionboard.com/?ipb21roadmap Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.