
01-04-2005, 09:26 PM
|
|
|
Join Date: Jan 2004
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
Quote:
Originally Posted by TRStealth
Hi,
I'm trying to get the 'Featured Article' thing to show up on the index page, but I'm having trouble.
I got the featured_article template to show, but the actual featured article won't.
I've added the following to the index.php page:
PHP Code:
$globaltemplates = array(
'FORUMHOME',
'forumhome_event',
'forumhome_forumbit_level1_nopost',
'forumhome_forumbit_level1_post',
'forumhome_forumbit_level2_nopost',
'forumhome_forumbit_level2_post',
'forumhome_lastpostby',
'forumhome_loggedinuser',
'forumhome_moderator',
'forumhome_pmloggedin',
'forumhome_subforumbit_nopost',
'forumhome_subforumbit_post',
'forumhome_subforumseparator_nopost',
'forumhome_subforumseparator_post',
'article_featured'
);
then
PHP Code:
require_once('./includes/functions_articles.php');
And finally
PHP Code:
// ### Start Articles
$featuredarticle = unserialize($datastore['featuredarticle']);
if ($featuredarticle['id'])
{
$feature = $DB_site->query_first("SELECT article.*, articlepost.*, articlecategory.options AS options FROM " . TABLE_PREFIX . "article AS article
INNER JOIN " . TABLE_PREFIX . "articlepost AS articlepost ON (articlepost.postid = article.firstpostid)
INNER JOIN " . TABLE_PREFIX . "articlecategory AS articlecategory ON (articlecategory.categoryid = article.categoryid)
WHERE article.articleid=$featuredarticle[id]");
}
if (!empty($feature['title']))
{
// do html
if ($feature['options'] & 256)
{
$dohtml = 1;
}
if ($feature['options'] & 512)
{
$dosmilies = 1;
}
// get an attachment, if there's one with a thumnail
$attachment = $DB_site->query_first("SELECT attachmentid FROM " . TABLE_PREFIX . "articleattachment WHERE articleid=$featuredarticle[id] AND thumbnail_dateline>1 ORDER BY RAND() LIMIT 0,1");
if (!empty($attachment['attachmentid']))
{
$GLOBALS['isattachment'] = true;
}
require_once('./includes/functions_bbcodeparse.php');
$feature['postbody'] = truncate_text($feature['postbody'], $vboptions['featuredlength'], 1);
$feature['postbody'] = parse_bbcode2($feature['postbody'], $dohtml, 0, $dosmilies, 1);
eval('$articlecontent .= "' . fetch_template('article_featured') . '";');
}
// ### End Articles
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ###
eval('$articlecontent .= "' . fetch_template('article_featured') . '";');
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('FORUMHOME') . '");');
However, this only displays the template, like I said. It doesn't show the featured article.
|
Hey I figured out how to add the featured article to the Forum Home...
You basically do everything you just did... plus
add $articlecontent to your FORUMHOME template
also in your index.php file
change
PHP Code:
$specialtemplates = array(
'userstats',
'birthdaycache',
'maxloggedin',
'iconcache',
'eventcache',
'mailqueue'
to
PHP Code:
$specialtemplates = array(
'userstats',
'birthdaycache',
'maxloggedin',
'iconcache',
'eventcache',
'mailqueue',
'featuredarticle'
);
Now whenever you feature an article it will also show on the Forum home... hope that helps.
|