vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




help with a template.. no one has been able to help me :(

bigike
03-23-2005, 10:27 PM
I have a php script which calls the most recent thread, author and first x number of words from a forum, but I am not sure what to put in the template, which "houses" the script. Here is the php script:
<?php

/* Needed for use without vBA
require_once('./global.php');
*/

/* ###### VARIOUS SETTINGS ###### */

$box_max_title_length=30;
$box_max_post_length=80;
$box_do_parse=0; /* Set to 1 to parse BBCODE */
$box_attachment_file="http://nymfans.com/forums/attachment.php?";

/* ###### GRABBING DATA ###### */

/* Only needed if you're going to be using bbcode */
if($box_do_parse==1){require_once('./includes/functions_bbcodeparse.php');}

/* Forum to Grab thread/post from */
$box_forumid_1=22;

/* Grabbing the thread */
$box_forumid_1thread = $DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."thread
WHERE forumid = '$box_forumid_1' ORDER BY thread.dateline DESC ");

/* Grabbing the first post */
$box_forumid_1_first_post=$DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."post
WHERE threadid = '$box_forumid_1thread[threadid]' ORDER BY dateline ASC");

/* Grabbing the first attachment */
$box_forumid_1_image=$DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."attachment
WHERE postid = '$box_forumid_1_first_post[postid]' ORDER BY dateline DESC");

$image1=$box_forumid_1_image['attachmentid'];

/* ###### FORMATING DATA ###### */

/* Max title length */
if(strlen($box_forumid_1thread[title])>$box_max_title_length){
$box_forumid_1thread[title]=substr($box_forumid_1thread[title], 0, $box_max_title_length);
}

/* Max post length */
if($box_forumid_1_first_post[pagetext]>$box_max_post_length){
$box_forumid_1_first_post[pagetext]=substr($box_forumid_1_first_post[pagetext], 0, $box_max_post_length);
}

/* Parse BBCODE if desired */
if($box_do_parse==1){
$box_forumid_1_first_post[pagetext]=parse_bbcode($box_forumid_1_first_post[pagetext]);
}

/* IMAGE CREATION */
$box_1_image="<img src='".$box_attachment_file."attachmentid=$img_m&stc=1' width='100' height='100' border='0'/>";

/* Template to use for data */
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('TEMPLATE_NAME_HERE') . '";');

?>
Here is the template I have, but I am not sure what variables to put in it to display the things pulled from the php script:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="90%">
<tr>
<td class="tcat">
<strong><span class="smallfont">$vba_options[portal_blockbullet] $vboptions[bbtitle] Features</strong></span>
</td>
</tr>
</table>
<table align="center" border="0" cellpadding="0" cellspacing="$stylevar[cellspacing]" class="tborder" width="90%" height="150">
<tr>
<td class="alt1">
<div align="center">$box_forumid_1thread</div>
</td>
</tr>
</tbody>
</table>
Any help would be GREATLY appreciated, because no one has been able to help me so far. Noppid has been the only one to give me useful tips over at vBulletin.org.

noppid
03-23-2005, 11:15 PM
Thread title: $box_forumid_1thread[title]
Post Text: $box_forumid_1_first_post[pagetext]
Image: $box_1_image

There are many more elements from those tables you can use. But those seem to be the point. Those queries pull the whole row though if ya want anything else.

bigike
03-23-2005, 11:30 PM
awesome man... thanks so much, i got it working now

bigike
03-24-2005, 11:45 AM
one other question... does anyone know why the text that is pulled is centered, and why the title cuts off before it is designated to do so? link to the homepage http://thevikesrike.tk

EDIT: nevermind, im an idiot. <div align="center"> was in the code. dont know how it got there, but it was the trouble maker. :)

bigike
03-24-2005, 12:08 PM
lol ok one more question... is there a way I can have text cut off at the end of the sentence, like at the first or second period? And, what would I do to have the title of the thread be a link to the whole post? thanks for the help


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum