I still cant get this thing to work, but here's a code snippet if thats any help... where {postid} should appear, it is just blank!
PHP Code:
<?php
//PluhNews 1.5 released under GNU GPL Licence version 2.0 (see copying.txt file for more info)
//Set your permissions in your control panel to make sure that only YOU and who you specify can post news. Otherwise, everyone and their dog can register and post in your news forums, thus posting where your news will appear. But for this script to work it's extra magic, be sure your members can reply to your news posts.
require("./newsconfig.php");
require('./admin/config.php');
str_replace('{postid}', $post['postid'], $bbcode);
//scroll down to edit the HTML for the news
//**********************
$newsforums = 47;
//Number of news items to show at once
$newsitems = 12;
//Path to your forums directory (leave out trailing slash)
$forumspath = "/";
//Start the goodies (please do not edit to goodies unless you know what you are doing
//connect
$connection = mysql_connect("$servername","$dbusername","$dbpassword") or die ("Cannot connect to server.");
//select database
$db = mysql_select_db("$dbname", $connection) or die ("Could not select database.");
// create sql statement
$sql = "SELECT threadid, title, forumid, replycount, postusername, postuserid, lastposter, dateline, iconid FROM thread WHERE forumid IN ($newsforums) ORDER BY threadid DESC LIMIT $newsitems";
//execute sql query
$sql_result = mysql_query($sql, $connection) or die ("Could not execute query.");
if (!$sql_result) {
echo "<p>Could not get record.";
}
while ($row = mysql_fetch_array($sql_result)) {
$threadid = $row["threadid"];
$title = $row["title"];
$forumid = $row["forumid"];
$replycount = $row["replycount"];
$postusername = $row["postusername"];
$postuserid = $row["postuserid"];
$lastposter = $row["lastposter"];
$iconid = $row["iconid"];
$dateline = $row["dateline"];
//create the second SQL statement to pull the post from the thread it resides in
$sql2 = "SELECT postid, threadid, username, userid, title, dateline, pagetext, iconid FROM post WHERE threadid = \"$threadid\" ORDER BY postid ASC LIMIT 1";
//execute second sql query
$sql_result2 = mysql_query($sql2, $connection) or die ("Could not execute query in second sql statement.");
if (!$sql_result2) {
echo "<p>Could not get record in second statement.";
}
while ($row2 = mysql_fetch_array($sql_result2)) {
$pagetext = $row2["pagetext"];
//gotta convert that damn unix time crap
$dateposted = vbdate("D j M Y, g:i A",$dateline);
//end the goodies
if ($replycount==1) {
$commenttext = "Comment";
}
else {
$commenttext = "Comments";
}
$bericht=bbcodeparse2($pagetext,"1","1","1","1");
// **********************
//Edit the HTML here (keep in mind that any double quote that is HTML requires a backslash in front of it)
echo "
<a name=\"$threadid\"></a>
<a href=\"showthread.php?s=&threadid=$threadid\"><b>$title</b></a><br>
</center>
<blockquote></a>$bericht</blockquote><center>Posted By <a href=\"member.php?s=&action=getinfo&userid=$postuserid\"><b>$postusername</b></a> at <i>$dateposted</i>
- <a href=\"showthread.php?s=&threadid=$threadid\"><b>$replycount</b> $commenttext</a></center><p><br><br>
";
}
}
//add news search stuff (this is optional - delete if you do not wish to include this, or edit it to meet your needs
echo "<center><a href=\"search.php?s=\">Search the News</a> | <a href=\"forumdisplay.php?s=&forumid=$newsforums\">View All News Posts</a></center>";
//end HTML edit
//**********************
//disconnect
mysql_free_result($sql_result);
mysql_close($connection);
?>