msimonds
03-12-2004, 06:16 PM
I use a script to put posts to my front page from a designated forum!!
I am trying to add to links to the script for a printable version & send to a friend links.
The script that I am tyring to add it to is here:
http://www.sportsrant.com/print.php (this is a test script)
all the code in the script is as follows:
<?php
// +-------------------------------------------------------------+
// | Turcic.com Website index.htm
// | Copyright ?2003 Alexander Turcic
// | Date: 2003/09/29 00:00:00 - Revision: 4.00
// +-------------------------------------------------------------+
error_reporting(E_ALL);
//chdir('./forums/');
chdir('/home/rantman/public_html/forums');
//chdir('./../upgrade/vb');
require_once('./global.php');
include("css.php");
csssite($pvlayer=0);
// #################### VB: DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('SESSION_BYPASS', 1);
define('LOCATION_BYPASS', 1);
define('DIE_QUIETLY', 1);
define('THIS_SCRIPT', 'external');
// ################### VB: PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array(
'userstats',
'birthdays',
'maxloggedin'
);
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### VB: REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_bbcodeparse.php');
chdir('..');
?>
<?php
// set announcement forum id
global $index,$fontcolor1,$fontcolor2,$fontcolor3,$fontco lor4,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4, $title;
$announceforums = "189";
$forumchoice = array();
$forumids = explode(',', $announceforums);
foreach ($forumids AS $forumid)
{
$forumid = intval($forumid);
if (isset($forumcache["$forumid"]))
{
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice))
{
$forumchoice = 'AND thread.forumid IN(' . implode(',', $forumchoice) . ')';
}
else
{
$forumchoice = '';
}
// if unlogged, set us up as a very limited privileges user
if (!$bbuserinfo['userid'])
{
$vboptions['hourdiff'] = (date('Z', TIMENOW) / 3600 - intval($_REQUEST['timeoffset'])) * 3600;
$bbuserinfo = array('usergroupid' => 1);
$usergroupcache = array();
$permissions = cache_permissions($bbuserinfo);
}
// get visible forums for this user
$forumids = array();
foreach (array_keys($forumcache) AS $forumid)
{
$fp = &$bbuserinfo['forumpermissions']["$forumid"];
if ($fp & CANVIEW AND $fp & CANVIEWOTHERS)
{
$forumids[] = $forumid;
}
}
$previewfield = "post.pagetext AS preview,";
$previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)";
// query last 15 threads from visible / chosen forums
$threads = $DB_site->query("
SELECT $previewfield
thread.postuserid, thread.replycount, thread.threadid, thread.title, thread.lastposter, thread.lastpost, thread.postusername, thread.dateline, forum.forumid, forum.title AS forumtitle
FROM " . TABLE_PREFIX . "thread AS thread
$previewjoin
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (deletionlog.primaryid = thread.threadid AND deletionlog.type = 'thread')
WHERE thread.forumid IN(" . implode(',', $forumids) . ") $forumchoice
AND thread.visible = 1
AND deletionlog.primaryid IS NULL
ORDER BY thread.dateline DESC
LIMIT 7
");
$threadcache = array();
while ($thread = $DB_site->fetch_array($threads))
{ // fetch the threads
$threadcache[] = $thread;
}
if (!empty($threadcache))
{
foreach ($threadcache AS $thread)
{
$thread['preview'] = strip_quotes($thread['preview']);
$thread['preview'] = fetch_trimmed_title(strip_bbcode($thread['preview'], true, true),750);
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td class=\"title\" align=\"center\">$thread[title]<br></td></tr>\n";
echo "<tr>";
echo "<td class=\"story\" align=\"right\">" . vbdate('M d, Y', $thread['dateline']) . " </font></td>\n";
echo "</tr>\n";
echo "<tr>";
echo "<td class=\"content\"><br>$thread[preview]</td></tr>";
echo "<tr>";
echo "<td class=\"RantBlackSmall\"><br><br>By: <a class=\"RantBlackSmall\" target=\"_blank\" href=\"forums/member.php?u=$thread[postuserid]\">$thread[postusername]</a></td></tr>";
echo "<tr>";
//echo "<td class=\"RantBlackSmall\" align=\"right\"><br><a class=\"story\" href=\"forums/showthread.php?t=$thread[threadid]\">Full Story .....</a><br><br><br><hr size=\"0\"></td>";
echo "<td class=\"RantBlackSmall\" align=\"center\"><br><a class=\"RantBlackSmall\" href=\"forums/showthread.php?t=$thread[threadid]\">Full Story</a> | <a class=\"RantBlackSmall\" href=\"forums/newreply.php?do=newreply&noquote=1&t=$thread[threadid]\">Comments</a> ($thread[replycount])<br><br><br><hr size=\"0\"></td>";
echo " </tr></table>";
}
}
?>
this is the line that I am having trouble with. I cannot get it to point to the correct thread as the Fullstory & Comments do!! Can someone help me out here! echo "<td class=\"RantBlackSmall\" width=\"50%\"><p align=\"right\"><a href=\"/forums/printthread.php?t=$threadid[threadid]\">Printable Version</a></td>";
I am trying to add to links to the script for a printable version & send to a friend links.
The script that I am tyring to add it to is here:
http://www.sportsrant.com/print.php (this is a test script)
all the code in the script is as follows:
<?php
// +-------------------------------------------------------------+
// | Turcic.com Website index.htm
// | Copyright ?2003 Alexander Turcic
// | Date: 2003/09/29 00:00:00 - Revision: 4.00
// +-------------------------------------------------------------+
error_reporting(E_ALL);
//chdir('./forums/');
chdir('/home/rantman/public_html/forums');
//chdir('./../upgrade/vb');
require_once('./global.php');
include("css.php");
csssite($pvlayer=0);
// #################### VB: DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('SESSION_BYPASS', 1);
define('LOCATION_BYPASS', 1);
define('DIE_QUIETLY', 1);
define('THIS_SCRIPT', 'external');
// ################### VB: PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array(
'userstats',
'birthdays',
'maxloggedin'
);
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### VB: REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_bbcodeparse.php');
chdir('..');
?>
<?php
// set announcement forum id
global $index,$fontcolor1,$fontcolor2,$fontcolor3,$fontco lor4,$bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4, $title;
$announceforums = "189";
$forumchoice = array();
$forumids = explode(',', $announceforums);
foreach ($forumids AS $forumid)
{
$forumid = intval($forumid);
if (isset($forumcache["$forumid"]))
{
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice))
{
$forumchoice = 'AND thread.forumid IN(' . implode(',', $forumchoice) . ')';
}
else
{
$forumchoice = '';
}
// if unlogged, set us up as a very limited privileges user
if (!$bbuserinfo['userid'])
{
$vboptions['hourdiff'] = (date('Z', TIMENOW) / 3600 - intval($_REQUEST['timeoffset'])) * 3600;
$bbuserinfo = array('usergroupid' => 1);
$usergroupcache = array();
$permissions = cache_permissions($bbuserinfo);
}
// get visible forums for this user
$forumids = array();
foreach (array_keys($forumcache) AS $forumid)
{
$fp = &$bbuserinfo['forumpermissions']["$forumid"];
if ($fp & CANVIEW AND $fp & CANVIEWOTHERS)
{
$forumids[] = $forumid;
}
}
$previewfield = "post.pagetext AS preview,";
$previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)";
// query last 15 threads from visible / chosen forums
$threads = $DB_site->query("
SELECT $previewfield
thread.postuserid, thread.replycount, thread.threadid, thread.title, thread.lastposter, thread.lastpost, thread.postusername, thread.dateline, forum.forumid, forum.title AS forumtitle
FROM " . TABLE_PREFIX . "thread AS thread
$previewjoin
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (deletionlog.primaryid = thread.threadid AND deletionlog.type = 'thread')
WHERE thread.forumid IN(" . implode(',', $forumids) . ") $forumchoice
AND thread.visible = 1
AND deletionlog.primaryid IS NULL
ORDER BY thread.dateline DESC
LIMIT 7
");
$threadcache = array();
while ($thread = $DB_site->fetch_array($threads))
{ // fetch the threads
$threadcache[] = $thread;
}
if (!empty($threadcache))
{
foreach ($threadcache AS $thread)
{
$thread['preview'] = strip_quotes($thread['preview']);
$thread['preview'] = fetch_trimmed_title(strip_bbcode($thread['preview'], true, true),750);
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td class=\"title\" align=\"center\">$thread[title]<br></td></tr>\n";
echo "<tr>";
echo "<td class=\"story\" align=\"right\">" . vbdate('M d, Y', $thread['dateline']) . " </font></td>\n";
echo "</tr>\n";
echo "<tr>";
echo "<td class=\"content\"><br>$thread[preview]</td></tr>";
echo "<tr>";
echo "<td class=\"RantBlackSmall\"><br><br>By: <a class=\"RantBlackSmall\" target=\"_blank\" href=\"forums/member.php?u=$thread[postuserid]\">$thread[postusername]</a></td></tr>";
echo "<tr>";
//echo "<td class=\"RantBlackSmall\" align=\"right\"><br><a class=\"story\" href=\"forums/showthread.php?t=$thread[threadid]\">Full Story .....</a><br><br><br><hr size=\"0\"></td>";
echo "<td class=\"RantBlackSmall\" align=\"center\"><br><a class=\"RantBlackSmall\" href=\"forums/showthread.php?t=$thread[threadid]\">Full Story</a> | <a class=\"RantBlackSmall\" href=\"forums/newreply.php?do=newreply&noquote=1&t=$thread[threadid]\">Comments</a> ($thread[replycount])<br><br><br><hr size=\"0\"></td>";
echo " </tr></table>";
}
}
?>
this is the line that I am having trouble with. I cannot get it to point to the correct thread as the Fullstory & Comments do!! Can someone help me out here! echo "<td class=\"RantBlackSmall\" width=\"50%\"><p align=\"right\"><a href=\"/forums/printthread.php?t=$threadid[threadid]\">Printable Version</a></td>";