####################################
[> Author: Cybermaster
[> Scripted for: Gesior's Simple forum script
[> Coding: PHP+XHTML+CSS
[> Version: 0.1
\_____________________________________________/
Description
This new function displays the latests posts made in your OT's forum, somewhat like the OTland's New Posts function. It consists of a SQL query that returns the last posts made by users, detailed with date, time, last poster, thread and section. It still doesn't look exactly like OTland's.
Preview
My Server is in spanish, so that's why you see the language diff.
Setup
STEP 1 (CSS SPAN STYLE)
OPEN "htdocs/forum.php" AND ADD THIS CODE AFTER THE FIRST "<?PHP"
STEP 2 (ADD THE 'NEW POSTS' LINK)
Search for:
Below it, add in the end of the first line of
This code:
STEP 3 (ADD MY FUNCTION)
Before
Add:
And that's it.eace:
###########################################
Tested with Gesior Account Maker, with TibiaCom Layout. TFS 0.3.6
[> Author: Cybermaster
[> Scripted for: Gesior's Simple forum script
[> Coding: PHP+XHTML+CSS
[> Version: 0.1
\_____________________________________________/
Description
This new function displays the latests posts made in your OT's forum, somewhat like the OTland's New Posts function. It consists of a SQL query that returns the last posts made by users, detailed with date, time, last poster, thread and section. It still doesn't look exactly like OTland's.
Preview
My Server is in spanish, so that's why you see the language diff.
Setup
STEP 1 (CSS SPAN STYLE)
OPEN "htdocs/forum.php" AND ADD THIS CODE AFTER THE FIRST "<?PHP"
HTML:
$main_content .= '<style type="text/css">
<!-- .Style1 {color: black}
.Header {color: black;font-size: small}
.SubHeader {color: white;font-size: x-small}
.Short {font-size: x-small}
.Style2 {color: white} -->
</style>';
STEP 2 (ADD THE 'NEW POSTS' LINK)
Search for:
PHP:
if($action == '')
PHP:
$main_content .=
PHP:
<a STYLE="text-decoration: none" href="?subtopic=forum&action=recent_posts"> <b>View Recent Posts</b></a>'
STEP 3 (ADD MY FUNCTION)
Before
PHP:
if($action == 'show_board')
PHP:
####################################################
//Recent Posts function for Gesior Forum. Scripted by Cybermaster
//Credits to OTland.net for the pictures
if($action == 'recent_posts')
{
$main_content .= '<span class="Header"><strong><a href="?subtopic=forum">Forum</a> > Recent Posts</span></strong><br/>';
$main_content .= '<table width="100%" border="0" cellpadding="0" cellspacing="1"><tr bgcolor="'.$config['site']['vdarkborder'].'" align="left"><td><font size="1"><span class="SubHeader"><strong>Thread</strong></td><td align="center"><span class="SubHeader"><strong>Last Post</strong></span></td><td align="center"><span class="SubHeader"><strong>Replies</b></span></td><td align="center"><span class="SubHeader"><strong>Views</strong></span></td><td align="left"><span class="SubHeader"><strong>Forum</strong></span></td></tr>';
$order = 0;
$posts = $SQL->query('SELECT id,first_post,post_topic,post_date,author_guid,post_text,section FROM z_forum ORDER BY post_date DESC LIMIT 40;');
foreach($posts as $post) {
$order++;
if(is_int($order / 2))
$bgcolor = $config['site']['darkborder'];
else
$bgcolor = $config['site']['lightborder'];
$_name = $SQL->query('SELECT `name` FROM `players` WHERE `id` = '.$post['author_guid'].'')->fetch();
$_replies = $SQL->query('SELECT `replies` FROM `z_forum` WHERE `first_post` = '.$post['first_post'].'')->fetch();
$_views = $SQL->query('SELECT `views` FROM `z_forum` WHERE `first_post` = '.$post['first_post'].'')->fetch();
$_text = $post['post_text'];
$_thread = $SQL->query('SELECT `post_topic` FROM `z_forum` WHERE `first_post` = '.$post['first_post'].'')->fetch();
if (strlen($_thread[0]) > 50) //Char Limit Config for the Threads
$_thread[0] = substr($_thread[0], 0, strrpos(substr($_thread[0], 0, 50), ' ')) . '...';
if (strlen($_text) > 50) //Char Limit Config for the Posts
$_text = substr($_text, 0, strrpos(substr($_text, 0, 50), ' ')) . '...';
$main_content .= '<tr bgcolor="'.$bgcolor.'">
<td><img src="http://otland.net/images/galaxy/misc/multipage.gif"> "'.$_text.'"</span><br/><img src="http://otland.net/images/galaxy/buttons/firstnew.gif"><b><a href="?subtopic=forum&action=show_thread&id='.urlencode($post['first_post']).'"><font size="1"><span class="Style1"> '.$_thread[0].'</a></b></span></td>
<td style="text-align: right;"><font size="1"><span class="Style1">'.date("F d (H:m)", $post[post_date]).' <br/>by <strong>'.$_name[0].' </strong></span><a href="?subtopic=forum&action=show_thread&id='.urlencode($post['first_post']).'"><img src="http://otland.net/images/galaxy/buttons/lastpost.gif" style="border: none;"></a></td>
<td><center><span class="Style1">'.$_replies[0].'</center></span></td>
<td><center><span class="Style1">'.$_views[0].'</center></span></td>
<td><span class="Short">'.$sections[$post[section]].'</span></td></tr>';
}
$main_content .= '</table>';
}
####################################################>
And that's it.eace:
###########################################
Tested with Gesior Account Maker, with TibiaCom Layout. TFS 0.3.6
Last edited: