cinq
02-27-2005, 10:00 PM
A small addon to show the latest featured articles on your Forum Home page.
This add on is for cinq's vbArticles Hack v2.0 (https://vborg.vbsupport.ru/showthread.php?t=74189)
Hack version 1.0
Install instructions
===========================================
1. In your 'FORUMHOME' template
FIND :
<!-- main -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
ADD BELOW :
<!-- vbArticles Featured Articles -->
<thead>
<tr>
<td class="thead" colspan="5">
<span style="float:$stylevar[right]"><a href="articles.php">More articles here</a></span>
Featured Articles in the $vbphrase[vbarticles]
</td></tr>
<tr>
<td class="alt1" colspan="5">
<table cellpadding="$stylevar[cellpadding]" cellspacing="1" border="0" width="100%">
<tr>
$featuredbitonforumhome
</tr>
</table>
</td></tr>
</thead>
<!-- /vbArticles Featured Articles -->
2. Create a new template : 'vbArticles_featuredbitonforumhome'
<td valign="top" align="center" class="alt2" width="33%">
<br>$articonimg<br>
<a href="articles.php?action=viewarticle&artid=$artid">
<span class="smallfont"><b>$title</b></span></a>
<br>$starrating<br><br></td>
3. Make the following code changes to your forum index.php
FIND:
$specialtemplates = array(
'userstats',
'birthdaycache',
'maxloggedin',
'iconcache',
'eventcache',
'mailqueue'
);
REPLACE WITH:
$specialtemplates = array(
'userstats',
'birthdaycache',
'maxloggedin',
'iconcache',
'eventcache',
'mailqueue',
'vbart_options'
);
FIND:
require_once('./includes/functions_forumlist.php');
ADD BELOW:
$vbart_options = unserialize($datastore['vbart_options']);
unset($datastore['vbart_options']);
FIND :
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
ADD ABOVE :
########################### vbArticles Hack by cinq ##############################
$artquery = $DB_site->query("
SELECT a.title, a.articles_articleid, a.icon, SUM(r.rating) / COUNT(r.rating) avg
FROM " . TABLE_PREFIX . "articles_article a
LEFT JOIN " . TABLE_PREFIX . "articles_rating r
ON a.articles_articleid = r.articleid
WHERE a.featured=1
GROUP BY a.articles_articleid
ORDER BY RAND()
LIMIT ".$vbart_options['numfeaturedarticlehome']."
");
if($DB_site->num_rows($artquery)>0)
{
while($artlisting=$DB_site->fetch_array($artquery))
{
$artid=$artlisting['articles_articleid'];
$title=$artlisting['title'];
$articon=$artlisting["icon"];
$rated = round($artlisting['avg']);
$starrating ="<img src=\"$stylevar[imgdir_rating]/rating_".$rated.".gif\" alt=\"Rating: $rated/5\" border=\"0\">";
$articon = ereg_replace($vbart_options['vbartartimgpathab'].$artid.'/',"",$articon);
$articonimg = "<img title=\"".$title."\" src=\"articles.php?action=thumb&artid=".$artid."&id=".$articon."\" border=\"0\" width=".$vbart_options['vbartssthumbwidth'].">";
eval('$featuredbitonforumhome .= "' . fetch_template('vbArticles_featuredbitonforumhome' ) . '";');
}
}
########################### vbArticles Hack by cinq ##############################
Save and upload index.php
4. Done :)
- cinq
This add on is for cinq's vbArticles Hack v2.0 (https://vborg.vbsupport.ru/showthread.php?t=74189)
Hack version 1.0
Install instructions
===========================================
1. In your 'FORUMHOME' template
FIND :
<!-- main -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
ADD BELOW :
<!-- vbArticles Featured Articles -->
<thead>
<tr>
<td class="thead" colspan="5">
<span style="float:$stylevar[right]"><a href="articles.php">More articles here</a></span>
Featured Articles in the $vbphrase[vbarticles]
</td></tr>
<tr>
<td class="alt1" colspan="5">
<table cellpadding="$stylevar[cellpadding]" cellspacing="1" border="0" width="100%">
<tr>
$featuredbitonforumhome
</tr>
</table>
</td></tr>
</thead>
<!-- /vbArticles Featured Articles -->
2. Create a new template : 'vbArticles_featuredbitonforumhome'
<td valign="top" align="center" class="alt2" width="33%">
<br>$articonimg<br>
<a href="articles.php?action=viewarticle&artid=$artid">
<span class="smallfont"><b>$title</b></span></a>
<br>$starrating<br><br></td>
3. Make the following code changes to your forum index.php
FIND:
$specialtemplates = array(
'userstats',
'birthdaycache',
'maxloggedin',
'iconcache',
'eventcache',
'mailqueue'
);
REPLACE WITH:
$specialtemplates = array(
'userstats',
'birthdaycache',
'maxloggedin',
'iconcache',
'eventcache',
'mailqueue',
'vbart_options'
);
FIND:
require_once('./includes/functions_forumlist.php');
ADD BELOW:
$vbart_options = unserialize($datastore['vbart_options']);
unset($datastore['vbart_options']);
FIND :
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
ADD ABOVE :
########################### vbArticles Hack by cinq ##############################
$artquery = $DB_site->query("
SELECT a.title, a.articles_articleid, a.icon, SUM(r.rating) / COUNT(r.rating) avg
FROM " . TABLE_PREFIX . "articles_article a
LEFT JOIN " . TABLE_PREFIX . "articles_rating r
ON a.articles_articleid = r.articleid
WHERE a.featured=1
GROUP BY a.articles_articleid
ORDER BY RAND()
LIMIT ".$vbart_options['numfeaturedarticlehome']."
");
if($DB_site->num_rows($artquery)>0)
{
while($artlisting=$DB_site->fetch_array($artquery))
{
$artid=$artlisting['articles_articleid'];
$title=$artlisting['title'];
$articon=$artlisting["icon"];
$rated = round($artlisting['avg']);
$starrating ="<img src=\"$stylevar[imgdir_rating]/rating_".$rated.".gif\" alt=\"Rating: $rated/5\" border=\"0\">";
$articon = ereg_replace($vbart_options['vbartartimgpathab'].$artid.'/',"",$articon);
$articonimg = "<img title=\"".$title."\" src=\"articles.php?action=thumb&artid=".$artid."&id=".$articon."\" border=\"0\" width=".$vbart_options['vbartssthumbwidth'].">";
eval('$featuredbitonforumhome .= "' . fetch_template('vbArticles_featuredbitonforumhome' ) . '";');
}
}
########################### vbArticles Hack by cinq ##############################
Save and upload index.php
4. Done :)
- cinq