View Single Post
  #10  
Old 10-16-2003, 08:54 PM
Trigunflame's Avatar
Trigunflame Trigunflame is offline
 
Join Date: Aug 2002
Posts: 742
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I worked on this for about 15 minutes, lots of stuff could be added/changed/improved/tweaked etc.. but this is a basic of how you would display posts within a topic.

ie. review.php?t=X (Where X = thread number)
Btw: I do recommend using / modifying the CSS tags even if you use your own header/footer.

PHP Code:
<?php

//+----------------------------
// Define Connection Variables
//+----------------------------

$site['name'] = "TF Topic View";    // Site Title

$db['host'] = "localhost";        // Server Host
$db['user'] = "root";            // Connect Username
$db['pass'] = "";            // Connect Password
$db['db'] = "forum";            // Database Name

$db['limit'] = 0;            // Show ONLY 1st Post | [0 = Off] [1 = On]

$layout['status'] = 1;            // Use Built In Template? [0 = Off] [1 = On]
$layout['bg'] = "#D2D2D2";        // Table BG Color
$layout['row1'] = "#EAEAEA";        // Row Alternate 1
$layout['row2'] = "#F2F2F2";        // Row Alternate 2

//+----------------------------
// Build MySQL Query Class
//+----------------------------

class mysql
{
    
//---------------------------
    // MySQL Initiation Function
    //---------------------------

    
function init ()
    {
        global 
$db;

        
mysql_connect($db['host'],$db['user'],$db['pass']);
        
mysql_select_db($db['db']);
    }

    
//---------------------------
    // Perform MySQL Query now..
    //---------------------------

    
function query ($sql)
    {
        static 
$i 0;
        if (!
$sql)
        {
            echo 
$i;
            return;
        }
        
$i++;

        return 
mysql_query ($sql);
    }

    
//---------------------------
    // MySQL Retrieval Functions
    //---------------------------

    
function fetch_result ($sql)
    {
        if (empty(
$sql))
        {
            die (
"No query supplemented : (Fetch Result)");
        }
        else
        {
            return 
mysql_result($sql,0);
        }
    }
    
    function 
fetch_array ($sql)
    {
        if (empty(
$sql))
        {
            die (
"No Query Supplemented : (Fetch Array)");
        }
        else
        {
            return 
mysql_fetch_array($sql);
        }
    }
}

//+------------------------------
// Initiate Everything MYSQL Now
//+------------------------------

$do = new mysql;
$do->init();

//+------------------------------
// Now Lets Begin Initialization
//+------------------------------

$thread $_GET['t'];            // Grab $_GET Variable


######################################################################
######################################################################
#include_once("./header.inc");
######################################################################
# If you want to use your own template uncomment the "Include_once"
# directive above, otherwise feel free for the script to use its
# own built in template.            -- Trigunflame
######################################################################
######################################################################

if ($layout['status'] == 1)
{

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo $site['name']; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 14px;
}

.style2 
{
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
}

.style4 
{
    font-family: Verdana, Arial, Helvetica, sans-serif; 
    font-size: 10px; 
}

.style5 
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-style: italic;
    font-weight: bold;
    font-size: 14px;
}

.style8 
{
    font-family: Verdana, Arial, Helvetica, sans-serif; 
    font-size: 10px; 
    font-weight: bold; 
}

.style9 
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
}

.style10 
{
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 1px;
}
-->
</style>
</head>
<body>

<?php
}

if (
$db['limit'] == 1)
{
    
$limit "LIMIT 1";
}
else
{
    
$limit NULL;
}

$topic $do->fetch_array($do->query("    SELECT * FROM thread
                    WHERE threadid=\""
.$thread."\"
                    LIMIT 1"
));

$query $do->query("    SELECT * FROM post
            WHERE threadid=\""
.$thread."\"
            ORDER BY postid
            ASC 
$limit");
?>

<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#D2D2D2">
  <tr>
    <td colspan="3"><span class="style1"><?php echo $topic[title]; ?></span></td>
  </tr>

<?php

$i 
1;
while (
$show $do->fetch_array($query))
{

?>

  <tr>
    <td width="20%" align="center" bgcolor="#E0E0E0"><span class="style4"><?php echo date("m.d.y"$show[dateline]);; ?></span></td>
    <td width="40%" bgcolor="#E0E0E0" class="style8"><?php echo $show[title]; ?></td>
    <td width="40%" align="right" bgcolor="#E0E0E0" class="style8">Post: <?php echo $i?>&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="top" bgcolor="#F0F0F0"><span class="style5"><?php echo $show[username].'</span><br /><span class="style4">User ID: '.$show[userid]; ?></span></td>
    <td colspan="2" bgcolor="#F0F0F0"><table width="100%"  border="0" cellspacing="1" cellpadding="4">
      <tr>
        <td valign="top"><span class="style9"><?php echo str_replace("\n","<br />",$show[pagetext]); ?></span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#F0F0F0"><span class="style4">&nbsp;</span></td>
    <td colspan="2" bgcolor="#F0F0F0">&nbsp;<span class="style8">Button1 Button2 Button3 Button4 Button5</span></td>
  </tr>
  <tr>
    <td width="20%" align="center" bgcolor="#D2D2D2" class="style10">&nbsp;</td>
    <td width="40%" bgcolor="#D2D2D2" class="style10">&nbsp;</td>
    <td width="40%" align="right" bgcolor="#D2D2D2" class="style10">&nbsp;</td>
  </tr>

<?php
    $i
++;
}

?>

  <tr>
    <td colspan="3"><span class="style2"><a href="#">Return to Top</a></span></td>
  </tr>
</table>

<?php

######################################################################
######################################################################
#include_once("./footer.inc");
######################################################################
# If you want to use your own template uncomment the "Include_once"
# directive above, otherwise feel free for the script to use its
# own built in template.            -- Trigunflame
######################################################################
######################################################################

if ($layout['status'] == 1)
{    

?>

</body>
</html>

<?php
}
?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01145 seconds
  • Memory Usage 1,864KB
  • 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
  • (1)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