PDA

View Full Version : Datastore


phoenixdown
11-07-2004, 12:40 PM
I am trying to intergrate some existing hacks into cmps modules but I am having problems with those retrieving data from via datastore.

Do I need to include a certain file to get that to work? I tried functions_bigthree.php but that wasn't of much help.

Sorry to be so vague.

Brian
11-07-2004, 12:42 PM
It shouldn't be any problem as some of the default modules use data from that table. Can you post some of the code you're trying?

Our Sponsors
 

phoenixdown
11-07-2004, 01:19 PM
This was taken almost directly from the post of the day hack at vb.org. The original instructions had this placed within the forums index.php file.



$tday = unserialize($datastore['threadoftheday']);
$tday['dateline'] = vbdate($vboptions['dateformat'], $tday['dateline'], 1);
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_postday') . '";');


The other one I was trying to get working was the featured article using the CMPS module relased on vb.org.


<?php
// ######################### REQUIRE BACK-END ############################
require_once('./includes/functions_articles.php');

// ###################### FEATURED ARTICLE TEASER ########################
$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_cmps') . '";');
}
// eval('print_output("' . fetch_template('adv_portal_blog') . '");');
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_blog') . '";');
?>


Both are eval'ing the templates but it appears that its not grabbing the info from the datastore as its showing up blank.

Brian
11-07-2004, 01:22 PM
Did you add 'threadoftheday' and 'featuredarticle' to the $specialtemplates array in global.php?

Our Sponsors
 

phoenixdown
11-07-2004, 01:28 PM
hmm it was there but they came before 'adv_modules' & 'adv_portal_opts' -- I moved it to the end and it works.

Thanks!

Brian
11-07-2004, 01:29 PM
Doesn't make any sense why that would make a difference, but glad you got it working. :)