hey, im not excellent at hard coding PHP so could I get a little bit of assistance in preparing a tabexternal.php for a specific
GARs module I am trying to put together to work with this script. basically what this module does is pull the latest defined amount of stories you want pulled from a specific GARs forum, and displays it similarly to how recent threads are displayed in the recent thread tabexternal.php. the only difference is that there is a GARs
header_image that is pulled, and also a
byline that are taken from different sql tables (
gars g sql tables, not
thread tables). if any of you use GARs, you should have an idea of what i'm talking about.
here is the GARs module code i am trying to plug into your ajax tabs script:
Code:
<?php
//SETTINGS
$forumids = "20"; // Comma seperated list of forumids
$limit = 5; // How many items to show
$title = "News"; // Module Title
$featured = 0; // 1= Only featured items
$url_to_default_image = "types/3/default.jpg"; //Relative URL to default image from geek/gars/images/ folder
$vertical = 1; // 1= Vertical (only for template 1 or 3)
$preview = 1; // 1= Show preview
$ratings = 0; // 1=show ratings
$template = 2; // 1=simple with pic, 2=big with pic, 3=Listing no pic
$order = 1; // 0 = rand, 1=desc, 2=asc
$maxchars = 400; // Maximum amount of chards to snip
$customfields = false; // Set to true to grab the custom fields.
$parsebb = true; //set to true to parse preview
// END SETTINGS
switch ($order)
{
case 0:
$order = "RAND()"; break;
case 1:
$order = "g.threadid DESC"; break;
default:
$order = "g.threadid ASC";
}
if (!$limit)
{
$limit = "1";
}
$sql = "SELECT g.threadid,g.header_image image, p.title, g.byline, t.forumid, t.dateline, t.postuserid, t.postusername " .
($preview ? ", IF(g.synopsis, g.synopsis, p.pagetext) synopsis " : "") .
($ratings ? ",round((g.overall_rating/10),0) author_rating, g.overall_rating author_rating_percent,round((g.avg_rating/10),0) member_rating, g.avg_rating member_rating_percent " : "" ) .
",g.pagecount, g.custom2 " . ($customfields ? ",gcv.*" : "") . " FROM
" . TABLE_PREFIX . "gars g
" . ($customfields ? " INNER JOIN " . TABLE_PREFIX . "gars_custom_values gcv ON gcv.custom_threadid = g.threadid " : "") . "
INNER JOIN " . TABLE_PREFIX . "thread t ON g.threadid = t.threadid
INNER JOIN " . TABLE_PREFIX . "post p ON t.firstpostid = p.postid
WHERE t.visible = 1 AND t.open != 10
" . ($forumids ? " AND t.forumid in ($forumids) " : "" ) . "
" . ($featured ? " AND g.feature_untill> " . TIMENOW : "") . "
ORDER BY $order LIMIT $limit";
$results = $db->query_read($sql);
$modulehtml = "";
$x = 0;
$bburl = $vbulletin->options['bburl'];
if ($template==2)
{
$vertical = 1;
}
$mods['colspan'] = ($template==2 ? 3 : $x);
$mods['collapse'] = $mods['modid'];
$modcollapse = $vbcollapse["collapseobj_module_" . $mods['modid'] . ""];
$modimgcollapse = $vbcollapse["collapseimg_module_" . $mods['modid'] . ""];
while ($result = $db->fetch_array($results))
{
if (!$result['image'])
{
$result['image'] = $vbulletin->options['bburl'] . "/geek/gars/images/" . $url_to_default_image;
}
elseif (substr($result['image'], 0, 1) == ".")
{
$result['image'] = $vbulletin->options['bburl'] . substr($result['image'], 1);
}
else
{
$result['image'] = $vbulletin->options['bburl'] . $result['image'];
}
if ($parsebb && $template!=3)
{
$result['message'] = $bbcode_parser->do_parse($result['synopsis'], 0, 1, 1, 1);
}
else
{
$result['message'] = strip_bbcode($result['synopsis']);
}
if (strlen($result['message']) > $maxchars)
{
$result['message'] = substr($result['message'], 0, strrpos(substr($result['message'], 0, $maxchars), ' ')) . '...' . ($template!=3 ? construct_phrase($vbphrase['read_more'], $vbulletin->options['bburl'], $result['threadid'], $session['sessionurl']) : "");
}
$result['dateposted'] = vbdate($vbulletin->options['dateformat'], $result['dateline']);
eval('$bits = "' . fetch_template('adv_portal_gars_bit' . $template) . '";');
if ($vertical && ($template != 2))
{
$modulehtml .= "<tr>$bits</tr>";
}
elseif ($vertical && $template == 2)
{
$mods['title'] = "<a href=\"$bburl/showthread.php?t=$result[threadid]\">$result[title]</a>";
$modulehtml = $bits;
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_module_shell') . '";');
}
else
{
$modulehtml .= $bits;
$x++;
}
}
if ($modulehtml && ($template != 2))
{
if (!$vertical)
{
$modulehtml = "<tr>$modulehtml</tr>";
}
$home[$mods['modid']]['content'] .= $modulehtml;
}
elseif ($modulehtml && $template == 2)
{
$mods['noshell'] = true;
}
?>
This is actually a CMPS module file, intended to be used with vBa CMPS, plugged in via the CMPS module system. you can find the actual module file and more information on the module here:
http://www.thevbgeek.com/showthread.php?t=1439
You can see the module running right on my webpage, underneath the News & Press Releases block, over at:
http://www.ready-up.com
Please help me to get this module running within the ajax tabs, I think it would be a great addition to this script as a lot of people use GARs. I tried myself to get it working, and I will continue trying on my own but like I've said i'm not so great at hardcoding PHP so i'm posting here in hope of getting a little bit of assistance. if i do happen to get this working, i will post the tabexternal php files for everyone else to use.
thanks in advance to anyone who helps out