View Single Post
  #1  
Old 03-12-2004, 06:16 PM
msimonds msimonds is offline
 
Join Date: Aug 2003
Location: Dallas, Texas
Posts: 157
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [request] help adding Printable link

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 Code:
<?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,$fontcolor4,$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'], truetrue),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>&nbsp;&nbsp;|&nbsp;&nbsp; <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!
PHP Code:
echo "<td class=\"RantBlackSmall\" width=\"50%\"><p align=\"right\"><a href=\"/forums/printthread.php?t=$threadid[threadid]\">Printable Version</a></td>"
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01203 seconds
  • Memory Usage 1,852KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete