PDA

View Full Version : [ADDON] cinq's vbArticles Latest 3 Articles VBIndex Block


cinq
02-24-2005, 10:00 PM
A small addon to show the latest 3 articles on your VBIndex page.
This add on vbIndex module is for cinq's vbArticles Hack v2.0 (https://vborg.vbsupport.ru/showthread.php?t=74189)

Hack version 1.0
Based on Creed's posted addon here (https://vborg.vbsupport.ru/showpost.php?p=600338&postcount=587), but amended slightly.

Install instructions
===========================================

1. Create a new template:

vbArticles_vbindex

<tr>
<td class="$bgclass"><a href="articles.php?action=viewarticle&artid=$latestarticleid"><font size=2><b>$title</b></font></a> <br> <span class="smallfont"><b>Author:</b> <i>$author</i> <br> <b>Date: </b><i>$date</i></span>
</td>
</tr>


2. Insert this code into one of your VBindex Custom Block Templates

adv_portal_articles

<table cellpadding="0" cellspacing="0" border="0" class="tborder" width="100%">
<tr>
<td>
<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<thead>
<tr>
<td class="tcat" style="text-align: center">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('vbindex_customblock$box')"><img id="collapseimg_vbindex_customblock$box" src="$stylevar[imgdir_button]/collapse_tcat$collapseimg_vbindex_customblock.gif" alt="" border="0" /></a>
<strong><a href="articles.php">Latest Articles</a></strong>
</td>
</tr>
</thead>
<tbody id="collapseobj_vbindex_customblock$box" style="$collapseobj_vbindex_customblock">
<tr>
<td class="alt1">
<div class="smallfont">$recentbit</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<br />


3. Next, perform the following file edit.
In your VBIndex.php file

FIND

// ######################## CREATE WELCOME BOX ###########################


ADD ABOVE

# Latest articles block on VbIndex
$latestarticlesquery = $DB_site->query("
SELECT a.title, a.articles_articleid, a.publishdate, a.author
FROM " . TABLE_PREFIX . "articles_article a
LEFT JOIN " . TABLE_PREFIX . "articles_category c
ON a.categoryid = c.articles_categoryid
WHERE a.categoryid != '0' AND a.draft !='1'
ORDER BY a.publishdate DESC
LIMIT 3");

if($DB_site->num_rows($latestarticlesquery))
{
while($latestarticlerow=$DB_site->fetch_array($latestarticlesquery))
{
$latestarticleid=$latestarticlerow['articles_articleid'];
$title=$latestarticlerow['title'];
$date = vbdate($vboptions['dateformat'],$latestarticlerow['publishdate'],true);
$author=$latestarticlerow['author'];
exec_switch_bg();
eval('$recentbit .= "' . fetch_template('vbArticles_vbindex') . '";');
}
}

Save and upload VBINDEX.php, overwriting the old file.


4. Done !

===========================================

Enjoy :)
- cinq

Creed
02-25-2005, 06:01 AM
Works like an absolute charm, sad thing is I made the same I just forgot after a fresh install of my board that the vbArticles_vbindex template didn't exist ;) lol THX!!

Moncal
03-23-2005, 06:00 PM
Great job thanks!

flaregun
05-04-2005, 06:01 PM
Can anyone help me out of modifing this code to show a small icon (50x50 or so) of the article's image left of the title?