Topic: Miniportal
Can anyone tell me/help me to get the miniportal to show topics from more than one forum id please?
Thanks a lot.
p0Wer~
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Miniportal
Can anyone tell me/help me to get the miniportal to show topics from more than one forum id please?
Thanks a lot.
p0Wer~
I have asked this question in a previous thread and no one ever answered. Hopefully they will for you.
Yeah, I really want this.
I want it for "forum hilights" so it takes hilights of the forums and displays it on the portal if you get what I mean
[There's no need to bump your topics after an hour -Smartys]
I want this also...
Sorry smartys
<?php
define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
$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';
function pun_news($fid=1, $show=15, $truncate=1)
{
global $lang_common, $db, $pun_config, $db_prefix;
$max_subject_length = 30;
$show_max_topics = 50;
$order_by = 't.posted';
$forum_sql = '';
// Was a forum ID supplied?
if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
$show = intval($show);
if ($show < 1 || $show > $show_max_topics)
$show = 15;
$saveddate="";
// Fetch $show topics
if (is_array($fid))
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
else
{
$fid = intval($fid);
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
}
$show_count = 0;
if ( !$db->num_rows($result) ) return $output;
while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
$temp = '';
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
if (pun_strlen($cur_topic['subject']) > $max_subject_length)
$subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
else
$subject_truncated = $cur_topic['subject'];
$newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>';
// Group posts by date
$thisdate = date('l, d F Y', $cur_topic['posted']);
if ($thisdate != $saveddate)
{
if ($saveddate)
{
$temp .= "</div></div>";
}
$temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>';
$saveddate = $thisdate;
}
else {
$temp .= '<div class="inbox"><p>';
}
$temp .= $newsheading.'</p><p>';
$id = $cur_topic['id'];
$msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
if ( !$db->num_rows($msg) ) continue;
$cur_post = $db->fetch_assoc($msg);
// Display first paragraph only (comment out next four lines to turn off)
if ($truncate == 1)
{
$paragraph = preg_split("/s*n+/", $cur_post['message']);
if (isset($paragraph[1])) {
$cur_post['message'] = $paragraph[0] . "...";
}
}
$cur_post['message'] = parse_message($cur_post['message'], 0);
$temp .= $cur_post['message'];
$temp .= "</p></div>";
if (isset($output)) {
$output .= $temp;
}
else {
$output = $temp;
}
++$show_count;
} // end of while
$output .= "</div></div>";
return $output;
}
?>
<div class="block">
<h2><span>Welcome</span></h2>
<div class="box">
<div class="inbox">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent augue. Nulla facilisi. Fusce bibendum accumsan erat. Quisque sollicitudin mattis neque. Sed dapibus. Integer a lectus eu sem consequat pellentesque. Morbi rhoncus nulla. Duis adipiscing interdum velit. Fusce ante. Ut vitae enim sit amet magna sodales hendrerit. In sed tortor at sapien convallis eleifend. Proin mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut metus. Cras ac arcu et arcu porttitor blandit. Nam vitae lectus eget mauris sollicitudin placerat. Suspendisse vestibulum. Donec varius libero. Duis velit tellus, euismod vitae, consequat sed, consectetuer ut, purus.
</p>
<p>
Praesent viverra venenatis magna. Etiam in dolor. Ut in justo ac nibh malesuada cursus. Duis urna arcu, aliquam vitae, consequat nec, tincidunt non, mi. Nunc lobortis. Nunc pharetra. Sed porttitor. Maecenas turpis tortor, blandit nec, dignissim in, porttitor eu, odio. In hac habitasse platea dictumst. Suspendisse augue odio, ornare a, elementum ac, tincidunt varius, orci. Nulla libero ante, hendrerit ac, consectetuer eu, sollicitudin et, eros. Duis sapien. Suspendisse ornare enim sit amet dui. Donec ullamcorper diam.
</p>
</div>
</div>
</div>
<?php
echo pun_news(1, 5, 0);
require PUN_ROOT.'footer.php';
instead of 1 for the forum id put array(1,2,3,4) with a list of the forums you want
where do u input that code at?
<?php define('PUN_ROOT', './'); define('PUN_QUIET_VISIT', 1); require PUN_ROOT.'include/common.php'; $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'; function pun_news($fid=1, $show=15, $truncate=1) { global $lang_common, $db, $pun_config, $db_prefix; $max_subject_length = 30; $show_max_topics = 50; $order_by = 't.posted'; $forum_sql = ''; // Was a forum ID supplied? if ( $fid ) $forum_sql = 'f.id='.$fid.' AND '; $show = intval($show); if ($show < 1 || $show > $show_max_topics) $show = 15; $saveddate=""; // Fetch $show topics if (is_array($fid)) $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); else { $fid = intval($fid); $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); } $show_count = 0; if ( !$db->num_rows($result) ) return $output; while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) { $temp = ''; if ($pun_config['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); if (pun_strlen($cur_topic['subject']) > $max_subject_length) $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...'; else $subject_truncated = $cur_topic['subject']; $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>'; // Group posts by date $thisdate = date('l, d F Y', $cur_topic['posted']); if ($thisdate != $saveddate) { if ($saveddate) { $temp .= "</div></div>"; } $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>'; $saveddate = $thisdate; } else { $temp .= '<div class="inbox"><p>'; } $temp .= $newsheading.'</p><p>'; $id = $cur_topic['id']; $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if ( !$db->num_rows($msg) ) continue; $cur_post = $db->fetch_assoc($msg); // Display first paragraph only (comment out next four lines to turn off) if ($truncate == 1) { $paragraph = preg_split("/s*n+/", $cur_post['message']); if (isset($paragraph[1])) { $cur_post['message'] = $paragraph[0] . "..."; } } $cur_post['message'] = parse_message($cur_post['message'], 0); $temp .= $cur_post['message']; $temp .= "</p></div>"; if (isset($output)) { $output .= $temp; } else { $output = $temp; } ++$show_count; } // end of while $output .= "</div></div>"; return $output; } ?> <div class="block"> <h2><span>Welcome</span></h2> <div class="box"> <div class="inbox"> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent augue. Nulla facilisi. Fusce bibendum accumsan erat. Quisque sollicitudin mattis neque. Sed dapibus. Integer a lectus eu sem consequat pellentesque. Morbi rhoncus nulla. Duis adipiscing interdum velit. Fusce ante. Ut vitae enim sit amet magna sodales hendrerit. In sed tortor at sapien convallis eleifend. Proin mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut metus. Cras ac arcu et arcu porttitor blandit. Nam vitae lectus eget mauris sollicitudin placerat. Suspendisse vestibulum. Donec varius libero. Duis velit tellus, euismod vitae, consequat sed, consectetuer ut, purus. </p> <p> Praesent viverra venenatis magna. Etiam in dolor. Ut in justo ac nibh malesuada cursus. Duis urna arcu, aliquam vitae, consequat nec, tincidunt non, mi. Nunc lobortis. Nunc pharetra. Sed porttitor. Maecenas turpis tortor, blandit nec, dignissim in, porttitor eu, odio. In hac habitasse platea dictumst. Suspendisse augue odio, ornare a, elementum ac, tincidunt varius, orci. Nulla libero ante, hendrerit ac, consectetuer eu, sollicitudin et, eros. Duis sapien. Suspendisse ornare enim sit amet dui. Donec ullamcorper diam. </p> </div> </div> </div> <?php echo pun_news(1, 5, 0); require PUN_ROOT.'footer.php';
instead of 1 for the forum id put array(1,2,3,4) with a list of the forums you want
thats an alternative version to the index.php in the miniportal mod, if this is easier...
find
$fid = intval($fid);
delete line
find
// Fetch $show topics
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
replace with
// Fetch $show topics
if (is_array($fid))
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
else
{
$fid = intval($fid);
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
}
would this work for my index.php that im creating ..
here is the thread
http://punbb.org/forums/viewtopic.php?id=16296&p=1
Q
thats an alternative version to the index.php in the miniportal mod, if this is easier...
find
$fid = intval($fid);
delete line
find// Fetch $show topics $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
replace with
// Fetch $show topics if (is_array($fid)) $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); else { $fid = intval($fid); $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); }
connorhd can u help with the coding.. i and bing have ask for help it seem we get questions with questions and no answers...
please?
yeh it would need a similar edit
<?php define('PUN_ROOT', './'); define('PUN_QUIET_VISIT', 1); require PUN_ROOT.'include/common.php'; $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'; function pun_news($fid=1, $show=15, $truncate=1) { global $lang_common, $db, $pun_config, $db_prefix; $max_subject_length = 30; $show_max_topics = 50; $order_by = 't.posted'; $forum_sql = ''; // Was a forum ID supplied? if ( $fid ) $forum_sql = 'f.id='.$fid.' AND '; $show = intval($show); if ($show < 1 || $show > $show_max_topics) $show = 15; $saveddate=""; // Fetch $show topics if (is_array($fid)) $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); else { $fid = intval($fid); $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); } $show_count = 0; if ( !$db->num_rows($result) ) return $output; while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) { $temp = ''; if ($pun_config['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); if (pun_strlen($cur_topic['subject']) > $max_subject_length) $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...'; else $subject_truncated = $cur_topic['subject']; $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>'; // Group posts by date $thisdate = date('l, d F Y', $cur_topic['posted']); if ($thisdate != $saveddate) { if ($saveddate) { $temp .= "</div></div>"; } $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>'; $saveddate = $thisdate; } else { $temp .= '<div class="inbox"><p>'; } $temp .= $newsheading.'</p><p>'; $id = $cur_topic['id']; $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if ( !$db->num_rows($msg) ) continue; $cur_post = $db->fetch_assoc($msg); // Display first paragraph only (comment out next four lines to turn off) if ($truncate == 1) { $paragraph = preg_split("/s*n+/", $cur_post['message']); if (isset($paragraph[1])) { $cur_post['message'] = $paragraph[0] . "..."; } } $cur_post['message'] = parse_message($cur_post['message'], 0); $temp .= $cur_post['message']; $temp .= "</p></div>"; if (isset($output)) { $output .= $temp; } else { $output = $temp; } ++$show_count; } // end of while $output .= "</div></div>"; return $output; } ?> <div class="block"> <h2><span>Welcome</span></h2> <div class="box"> <div class="inbox"> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent augue. Nulla facilisi. Fusce bibendum accumsan erat. Quisque sollicitudin mattis neque. Sed dapibus. Integer a lectus eu sem consequat pellentesque. Morbi rhoncus nulla. Duis adipiscing interdum velit. Fusce ante. Ut vitae enim sit amet magna sodales hendrerit. In sed tortor at sapien convallis eleifend. Proin mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut metus. Cras ac arcu et arcu porttitor blandit. Nam vitae lectus eget mauris sollicitudin placerat. Suspendisse vestibulum. Donec varius libero. Duis velit tellus, euismod vitae, consequat sed, consectetuer ut, purus. </p> <p> Praesent viverra venenatis magna. Etiam in dolor. Ut in justo ac nibh malesuada cursus. Duis urna arcu, aliquam vitae, consequat nec, tincidunt non, mi. Nunc lobortis. Nunc pharetra. Sed porttitor. Maecenas turpis tortor, blandit nec, dignissim in, porttitor eu, odio. In hac habitasse platea dictumst. Suspendisse augue odio, ornare a, elementum ac, tincidunt varius, orci. Nulla libero ante, hendrerit ac, consectetuer eu, sollicitudin et, eros. Duis sapien. Suspendisse ornare enim sit amet dui. Donec ullamcorper diam. </p> </div> </div> </div> <?php echo pun_news(1, 5, 0); require PUN_ROOT.'footer.php';
instead of 1 for the forum id put array(1,2,3,4) with a list of the forums you want
I've done that now, but the index only shows the text at the bottom of the file, it doesn't show any topics
power we have been working on a new index.php for a while at this threat maybe this will help you!
http://punbb.org/forums/viewtopic.php?id=16296&p=5
Q
power we have been working on a new index.php for a while at this threat maybe this will help you!
http://punbb.org/forums/viewtopic.php?id=16296&p=5Q
I'll wait until it's completed, thanks!
Connorhd wrote:<?php define('PUN_ROOT', './'); define('PUN_QUIET_VISIT', 1); require PUN_ROOT.'include/common.php'; $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'; function pun_news($fid=1, $show=15, $truncate=1) { global $lang_common, $db, $pun_config, $db_prefix; $max_subject_length = 30; $show_max_topics = 50; $order_by = 't.posted'; $forum_sql = ''; // Was a forum ID supplied? if ( $fid ) $forum_sql = 'f.id='.$fid.' AND '; $show = intval($show); if ($show < 1 || $show > $show_max_topics) $show = 15; $saveddate=""; // Fetch $show topics if (is_array($fid)) $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); else { $fid = intval($fid); $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); } $show_count = 0; if ( !$db->num_rows($result) ) return $output; while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) { $temp = ''; if ($pun_config['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); if (pun_strlen($cur_topic['subject']) > $max_subject_length) $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...'; else $subject_truncated = $cur_topic['subject']; $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>'; // Group posts by date $thisdate = date('l, d F Y', $cur_topic['posted']); if ($thisdate != $saveddate) { if ($saveddate) { $temp .= "</div></div>"; } $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>'; $saveddate = $thisdate; } else { $temp .= '<div class="inbox"><p>'; } $temp .= $newsheading.'</p><p>'; $id = $cur_topic['id']; $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if ( !$db->num_rows($msg) ) continue; $cur_post = $db->fetch_assoc($msg); // Display first paragraph only (comment out next four lines to turn off) if ($truncate == 1) { $paragraph = preg_split("/s*n+/", $cur_post['message']); if (isset($paragraph[1])) { $cur_post['message'] = $paragraph[0] . "..."; } } $cur_post['message'] = parse_message($cur_post['message'], 0); $temp .= $cur_post['message']; $temp .= "</p></div>"; if (isset($output)) { $output .= $temp; } else { $output = $temp; } ++$show_count; } // end of while $output .= "</div></div>"; return $output; } ?> <div class="block"> <h2><span>Welcome</span></h2> <div class="box"> <div class="inbox"> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent augue. Nulla facilisi. Fusce bibendum accumsan erat. Quisque sollicitudin mattis neque. Sed dapibus. Integer a lectus eu sem consequat pellentesque. Morbi rhoncus nulla. Duis adipiscing interdum velit. Fusce ante. Ut vitae enim sit amet magna sodales hendrerit. In sed tortor at sapien convallis eleifend. Proin mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut metus. Cras ac arcu et arcu porttitor blandit. Nam vitae lectus eget mauris sollicitudin placerat. Suspendisse vestibulum. Donec varius libero. Duis velit tellus, euismod vitae, consequat sed, consectetuer ut, purus. </p> <p> Praesent viverra venenatis magna. Etiam in dolor. Ut in justo ac nibh malesuada cursus. Duis urna arcu, aliquam vitae, consequat nec, tincidunt non, mi. Nunc lobortis. Nunc pharetra. Sed porttitor. Maecenas turpis tortor, blandit nec, dignissim in, porttitor eu, odio. In hac habitasse platea dictumst. Suspendisse augue odio, ornare a, elementum ac, tincidunt varius, orci. Nulla libero ante, hendrerit ac, consectetuer eu, sollicitudin et, eros. Duis sapien. Suspendisse ornare enim sit amet dui. Donec ullamcorper diam. </p> </div> </div> </div> <?php echo pun_news(1, 5, 0); require PUN_ROOT.'footer.php';
instead of 1 for the forum id put array(1,2,3,4) with a list of the forums you want
I've done that now, but the index only shows the text at the bottom of the file, it doesn't show any topics
What do you mean? it shows the php code? in which case did you delete a <?php
p0Wer wrote:Connorhd wrote:<?php define('PUN_ROOT', './'); define('PUN_QUIET_VISIT', 1); require PUN_ROOT.'include/common.php'; $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'; function pun_news($fid=1, $show=15, $truncate=1) { global $lang_common, $db, $pun_config, $db_prefix; $max_subject_length = 30; $show_max_topics = 50; $order_by = 't.posted'; $forum_sql = ''; // Was a forum ID supplied? if ( $fid ) $forum_sql = 'f.id='.$fid.' AND '; $show = intval($show); if ($show < 1 || $show > $show_max_topics) $show = 15; $saveddate=""; // Fetch $show topics if (is_array($fid)) $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id IN ('.implode(",",$fid).') AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); else { $fid = intval($fid); $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error()); } $show_count = 0; if ( !$db->num_rows($result) ) return $output; while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) { $temp = ''; if ($pun_config['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); if (pun_strlen($cur_topic['subject']) > $max_subject_length) $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...'; else $subject_truncated = $cur_topic['subject']; $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.pun_htmlspecialchars($subject_truncated).'</a> - <em>Posted by '.$cur_topic['poster'].' at '.date('h:i A', $cur_topic['posted']).'</em><br>'; // Group posts by date $thisdate = date('l, d F Y', $cur_topic['posted']); if ($thisdate != $saveddate) { if ($saveddate) { $temp .= "</div></div>"; } $temp .= '<div class="block"><h2><span>'.$thisdate.'</span></h2><div class="box"><div class="inbox"><p>'; $saveddate = $thisdate; } else { $temp .= '<div class="inbox"><p>'; } $temp .= $newsheading.'</p><p>'; $id = $cur_topic['id']; $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if ( !$db->num_rows($msg) ) continue; $cur_post = $db->fetch_assoc($msg); // Display first paragraph only (comment out next four lines to turn off) if ($truncate == 1) { $paragraph = preg_split("/s*n+/", $cur_post['message']); if (isset($paragraph[1])) { $cur_post['message'] = $paragraph[0] . "..."; } } $cur_post['message'] = parse_message($cur_post['message'], 0); $temp .= $cur_post['message']; $temp .= "</p></div>"; if (isset($output)) { $output .= $temp; } else { $output = $temp; } ++$show_count; } // end of while $output .= "</div></div>"; return $output; } ?> <div class="block"> <h2><span>Welcome</span></h2> <div class="box"> <div class="inbox"> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent augue. Nulla facilisi. Fusce bibendum accumsan erat. Quisque sollicitudin mattis neque. Sed dapibus. Integer a lectus eu sem consequat pellentesque. Morbi rhoncus nulla. Duis adipiscing interdum velit. Fusce ante. Ut vitae enim sit amet magna sodales hendrerit. In sed tortor at sapien convallis eleifend. Proin mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut metus. Cras ac arcu et arcu porttitor blandit. Nam vitae lectus eget mauris sollicitudin placerat. Suspendisse vestibulum. Donec varius libero. Duis velit tellus, euismod vitae, consequat sed, consectetuer ut, purus. </p> <p> Praesent viverra venenatis magna. Etiam in dolor. Ut in justo ac nibh malesuada cursus. Duis urna arcu, aliquam vitae, consequat nec, tincidunt non, mi. Nunc lobortis. Nunc pharetra. Sed porttitor. Maecenas turpis tortor, blandit nec, dignissim in, porttitor eu, odio. In hac habitasse platea dictumst. Suspendisse augue odio, ornare a, elementum ac, tincidunt varius, orci. Nulla libero ante, hendrerit ac, consectetuer eu, sollicitudin et, eros. Duis sapien. Suspendisse ornare enim sit amet dui. Donec ullamcorper diam. </p> </div> </div> </div> <?php echo pun_news(1, 5, 0); require PUN_ROOT.'footer.php';
instead of 1 for the forum id put array(1,2,3,4) with a list of the forums you want :)
I've done that now, but the index only shows the text at the bottom of the file, it doesn't show any topics :(
What do you mean? it shows the php code? in which case did you delete a <?php
No, it only showed: <p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent augue. Nulla facilisi. Fusce bibendum accumsan erat. Quisque sollicitudin mattis neque. Sed dapibus. Integer a lectus eu sem consequat pellentesque. Morbi rhoncus nulla. Duis adipiscing interdum velit. Fusce ante. Ut vitae enim sit amet magna sodales hendrerit. In sed tortor at sapien convallis eleifend. Proin mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut metus. Cras ac arcu et arcu porttitor blandit. Nam vitae lectus eget mauris sollicitudin placerat. Suspendisse vestibulum. Donec varius libero. Duis velit tellus, euismod vitae, consequat sed, consectetuer ut, purus.
</p>
<p>
Praesent viverra venenatis magna. Etiam in dolor. Ut in justo ac nibh malesuada cursus. Duis urna arcu, aliquam vitae, consequat nec, tincidunt non, mi. Nunc lobortis. Nunc pharetra. Sed porttitor. Maecenas turpis tortor, blandit nec, dignissim in, porttitor eu, odio. In hac habitasse platea dictumst. Suspendisse augue odio, ornare a, elementum ac, tincidunt varius, orci. Nulla libero ante, hendrerit ac, consectetuer eu, sollicitudin et, eros. Duis sapien. Suspendisse ornare enim sit amet dui. Donec ullamcorper diam.
Didn't show any topics from any forums :/
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Miniportal
Powered by PunBB, supported by Informer Technologies, Inc.