Well, I've tested this truncation and it works to some degree. if however there are more than 2 posts on the frontpage then the 3rd post does not get truncated. I believe that this is because the id="truncateMe" is set in the <td field.
551 2007-06-19 21:40
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
552 2007-06-19 18:39
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
MattF - Why not use the last script we posted. It works and truncates..
553 2007-06-19 18:26
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Here again is my working copy:
<style>
.news_subject {
background-color: inherit;
font-family: Tahoma, Verdana, "Lucida Sans Unicode", Arial, sans-serif;
font-size: 1.2em;
font-weight: bold;
text-decoration:none;
border-bottom:1px dotted #065C7C
}
a.news_subject:hover {
background-color: inherit;
color: #000000;
text-decoration: none;
border-bottom:1px solid #065C7C
}
.news_footer {
background-color: #DBE9EC;
color: inherit;
border-bottom: 1px solid #BBCEDE;
border-right: 1px solid #BBCEDE;
}
</style>
<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<script type="text/javascript">
var len = 890;
var p = document.getElementById('truncateMe');
if (p) {
var trunc = p.innerHTML;
if (trunc.length > len) {
/* Truncate the content of the P, then go back to the end of the
previous word to ensure that we don't truncate in the middle of
a word */
trunc = trunc.substring(0, len);
trunc = trunc.replace(/\w+$/, '');
/* Add an ellipses to the end and make it a link that expands
the paragraph back to its original size */
trunc += '<a href="#" ' +
'onclick="this.parentNode.innerHTML=' +
'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
'...<\/a>';
p.innerHTML = trunc;
}
}
</script>
<div class="block">
<?php
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
}
else
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border: 0px; width: 90%;" valign="top" id="truncateMe"><?php echo $cur_post['message']."\n" ?></td>
<td align="right" style="border: 0px; width: 10%;" valign="top"><?php echo $user_avatar ?></td>
</tr>
</table>
<br />
<br />
<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<?php
echo "\t\t\t\t\t\t\t".'<span class="byuser" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.'</a></span>'."\n\n\n\n";
?>
</td>
</tr>
</table>
</ul>
</div>
</div>
</div>
<?
}
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
554 2007-06-19 16:41
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Where in the script would the above be placed?
555 2007-06-19 14:17
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
You can add the following to your styleheet_cs.css file. This is for the news footer etc.
/* News Links on index page */
.news_subject {
background-color: inherit;
font-family: Tahoma, Verdana, "Lucida Sans Unicode", Arial, sans-serif;
font-size: 1.2em;
font-weight: bold;
text-decoration:none;
border-bottom:1px dotted #065C7C
}
a.news_subject:hover {
background-color: inherit;
color: #000000;
text-decoration: none;
border-bottom:1px solid #065C7C
}
.news_footer {
background-color: #DBE9EC;
color: inherit;
border-bottom: 1px solid #BBCEDE;
border-right: 1px solid #BBCEDE;
}
556 2007-06-19 01:13
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Thanks for letting me know. I'll update my last post.
557 2007-06-18 22:51
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
It will be perfect once we can get the text truncated.
558 2007-06-18 22:10
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Well, You don't need the avatar mod. All they would need to do is place a blank image called: noimage.gif in the images folder.
559 2007-06-18 19:35
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Here is my final coding for the index.php. I will post this one here with hopes that someone will add the truncate function to it. Not the Mega Pun version. I prefer this layout.
<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
if ($pun_config['o_index_message_show'] == 1)
{
?>
<div class="block">
<h2><span><?php echo pun_htmlspecialchars($pun_config['o_index_message_head']) ?></span></h2>
<div class="box">
<div class="inbox">
<?php echo $pun_config['o_index_message'] ?>
</div>
</div>
</div>
<?php
}
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="block">
<?php
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
}
else
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border: 0px; width: 90%;"><?php echo $cur_post['message']."\n" ?></td>
<td align="right" style="border: 0px; width: 10%;" valign="top"><?php echo $user_avatar ?></td>
</tr>
</table>
<br />
<br />
<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<?php
echo "\t\t\t\t\t\t\t".'<span class="byuser" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.'</span>'."\n\n\n\n";
?>
</td>
</tr>
</table>
</ul>
</div>
</div>
</div>
<?
}
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
560 2007-06-18 19:34
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
I already fixed it...thanks
561 2007-06-18 12:45
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
This version below uses an avatar.
<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.poster AS username, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="block">
<?php
if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
{
if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['username'].'\'s Avatar" alt="'.$cur_post['username'].'\'s Avatar" /></a>';
}
else
$user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td style="border: 0px;" width="90%"><?php echo $cur_post['message']."\n" ?></td>
<td align="right" style="border: 0px;" width="10%" valign="top"><?php echo $user_avatar ?></td>
</tr>
</table>
<br />
<br />
<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<?php
echo "\t\t\t\t\t\t\t".'<span class="byuser" style="float:left">Posted on: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.'</span>'."\n\n\n\n";
?>
</td>
</tr>
</table>
</ul>
</div>
</div>
</div>
<?
}
}
else
{
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
562 2007-06-18 11:23
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Does anyone know how to put this all together to make it work?
563 2007-06-18 02:44
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
I also asked soonotes if he can assist with the truncate feature so I am just waiting on his response.
Shedrock
564 2007-06-18 01:08
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
I must have screwed up something. Anyway, I re-installed pun and it all works now.
565 2007-06-18 00:49
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
I couldn't figure out who "Bling" was and then I figured it must be Bingiman you're meaning to type. Anyway, I see it works on your site but it is not working on mine. I am using a fresh install of punBB 1.2.14 updated to 1.2.15 and this shouldn't cause the problem. I currently have 3 test post. If I click on the post with ID#1 all the options work just fine. However, if I have other posts on the frontpage the result with edit is the wrong post. The quote also does not work for me. I get a "bad request"
566 2007-06-17 23:45
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
Here is my code. It should validate now. This still doesn't have the fix for the Edit and Delete functions.
<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';
$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result))
{
while($cur_post = $db->fetch_assoc($result))
{
$cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
?>
<div class="block">
<?php
echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
<div class="inbox">
<ul><li>
<div style="padding-bottom: 6px;" ><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><strong><?php echo $cur_post['subject']; ?></strong></a></div>
<?php echo $cur_post['message']."\n" ?><br /><br />
<?php
echo "\t\t\t\t\t\t\t".'<hr /><span class="byuser" style="float:left">Posted on: '.format_time($cur_post['posted']).' by:<span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a> | Views: '. $cur_post['num_views'].' | Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
echo "\t\t\t\t\t\t\t".'<a style="text-decoration: none" href="viewtopic.php?id='.$cur_post['id'].'" class="username">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a></span>'."\n\n\n\n";
?>
<br />
</ul>
</div>
</div>
</div>
<?
}
}
else
{
}
?>
<br />
<br />
<?php
require PUN_ROOT.'footer.php';
567 2007-06-17 23:43
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
@Quaker - How can I fix that issue with the edit and delete function?
568 2007-06-17 23:42
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
bingiman wrote:This is totally awesome. You should have it so that it truncates to a set amount of text. Something like I have in Mega Pun. I think it would be great because then you will have too much clutter on the front page. Maybe add a read more link?
Shedrock
The only problem with truncation is that it screws the W3C compliance if it happens to trim the message inbetween a pair of tags.
Actually, this is true but soonotes (tinytim) managed to resolve this issue with his User Blogs.
569 2007-06-17 16:26
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
There is something wrong with this mod. If you try to edit or delete a specific post on the front page, it reads a different post therefore it will delete the wrong post.
570 2007-06-17 11:37
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
It is the index.php in Mega Pun that has the modded news. As for cleaning up your index.php file. I managed to make it 100% W3C compliant. I can post it here or let me know when you come on to MSN.
Shedrock
571 2007-06-17 02:22
Re: New frontpage index mod! (188 replies, posted in PunBB 1.2 modifications, plugins and integrations)
This is totally awesome. You should have it so that it truncates to a set amount of text. Something like I have in Mega Pun. I think it would be great because then you will have too much clutter on the front page. Maybe add a read more link?
Shedrock
572 2007-05-26 00:06
Re: Mega Pun 2.00 (24 replies, posted in PunBB 1.2 show off)
answered on http://shedrockonline.com
573 2007-05-22 22:23
Re: Mega Pun 2.00 (24 replies, posted in PunBB 1.2 show off)
In this version I got rid of the left/right switchable blocks. It was only implemented because I could not get the layout to work right with all the different browsers out there, then I kept at it and noticed that punres uses percentages for their layout so I tried it and this seems to have worked along with some minor tweaking. In some screens you will see the left blocks enabled and in others the left/right blocks are off. I had to do this to allow narrow width themes to work without breaking the layout of the theme. Unfortunately I didn't have much of a choice. The way Mega Pun is laid out is the best solution I could come up with. As much as I like using DIVS, they certainly aren't as flexible and forgiving as tables. If it were up to me I would have punBB using strictly tables. You can do so much more with them.
574 2007-05-21 21:26
Re: Mega Pun 2.00 (24 replies, posted in PunBB 1.2 show off)
lol - I will definitely work on the Calendar and Gallery. I am lost regarding the other 2. Well, at least 1 of them.
575 2007-05-21 21:19
Topic: Mega Pun 2.00 (24 replies, posted in PunBB 1.2 show off)
After lots of hard work trying to get everything to work well with Mega Pun. After numerous attempts to get the left/right blocks working right with all popular browsers, I think we've managed to get it working right this time. It is currently being used on http://shedrockonline.com and you can also download it from our files section.
Just to refresh everyone's memory about Mega Pun.
Mega Pun is nothing more than punBB. Mega Pun as the name implies is exactly that. There are MEGA mods/plugins included and all pre setup for people who do not want to take on the task themselves. Please feel free to download it and give me some feedback. I would also like to thank tinytim (http://sooblogs.com) again for his ongoing help and support.
Thanks
Shedrock / Bingiman