AndrewSimm
05-19-2013, 06:02 AM
I need the $section1 have the value of {vb:raw entry.field97}. What I am going it showing the cms articles of a particular section in a vbdynamics page. The current code show section 1 but I need to be able to change the section for each entry which is defined in {vb:raw entry.field97}.
<?php
// Set Your Section ID Here
$section1 = '1';
// Set The Number of Articles To Display
$limit1 = '20';
$articlegrab1 = vB::$db->query_read("
SELECT ".TABLE_PREFIX."cms_nodeinfo.nodeid
, ".TABLE_PREFIX."cms_nodeinfo.title
, ".TABLE_PREFIX."cms_article.previewtext
, ".TABLE_PREFIX."cms_article.pagetext
, ".TABLE_PREFIX."cms_article.contentid
, ".TABLE_PREFIX."cms_node.nodeid
, ".TABLE_PREFIX."cms_node.parentnode
, ".TABLE_PREFIX."cms_node.contentid
, ".TABLE_PREFIX."cms_node.url
, ".TABLE_PREFIX."cms_node.publishdate
, ".TABLE_PREFIX."cms_node.setpublish
FROM ".TABLE_PREFIX."cms_article
, ".TABLE_PREFIX."cms_nodeinfo
, ".TABLE_PREFIX."cms_node
WHERE (".TABLE_PREFIX."cms_nodeinfo.nodeid = ".TABLE_PREFIX."cms_node.nodeid)
AND (".TABLE_PREFIX."cms_article.contentid = ".TABLE_PREFIX."cms_node.contentid)
AND (".TABLE_PREFIX."cms_node.parentnode IN ($section1))
AND (".TABLE_PREFIX."cms_node.setpublish != 0)
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit1
");
while($articleinfo1 = vB::$db->fetch_array($articlegrab1)) {
$title1 = $articleinfo1['title'];
$text1= $articleinfo1['previewtext'];
$nodeid1 = $articleinfo1['nodeid'];
$url1 = $articleinfo1['url'];
$pagetext1 = $articleinfo1['pagetext'];
$unixdate1 = $articleinfo1['publishdate'];
$date1 = date("F j, Y, g:i a", $unixdate1);
$fulltext1 = strip_bbcode($fulltext1);
$text1 = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
$text1 = strip_bbcode($text1);
$pagetext1 = strip_bbcode($pagetext1);
if($text1 == '') $pagetext1 = substr($pagetext1, 0, 120);
$centerhtml1 .="<div style='padding-bottom:10px;margin-bottom:10px; margin-left:8px; margin-right:8px;border-bottom:1px solid #cccccc''>";
$centerhtml1 .="<b><a href='/content.php?".$nodeid1."-".$url1."'>".$title1."</a></b>";
$centerhtml1 .="<p><span style='color:#6f6f6f'>".$date1."</span></p>";
$centerhtml1 .="<p>".$pagetext1."...</p></div>";
}
vB::$db->free_result($articlegrab1);
$tabhtml1 = "<div><ul>".$tabhtml1."</ul>";
echo $tabhtml1.$centerhtml1."</div>";
//
?>
<?php
// Set Your Section ID Here
$section1 = '1';
// Set The Number of Articles To Display
$limit1 = '20';
$articlegrab1 = vB::$db->query_read("
SELECT ".TABLE_PREFIX."cms_nodeinfo.nodeid
, ".TABLE_PREFIX."cms_nodeinfo.title
, ".TABLE_PREFIX."cms_article.previewtext
, ".TABLE_PREFIX."cms_article.pagetext
, ".TABLE_PREFIX."cms_article.contentid
, ".TABLE_PREFIX."cms_node.nodeid
, ".TABLE_PREFIX."cms_node.parentnode
, ".TABLE_PREFIX."cms_node.contentid
, ".TABLE_PREFIX."cms_node.url
, ".TABLE_PREFIX."cms_node.publishdate
, ".TABLE_PREFIX."cms_node.setpublish
FROM ".TABLE_PREFIX."cms_article
, ".TABLE_PREFIX."cms_nodeinfo
, ".TABLE_PREFIX."cms_node
WHERE (".TABLE_PREFIX."cms_nodeinfo.nodeid = ".TABLE_PREFIX."cms_node.nodeid)
AND (".TABLE_PREFIX."cms_article.contentid = ".TABLE_PREFIX."cms_node.contentid)
AND (".TABLE_PREFIX."cms_node.parentnode IN ($section1))
AND (".TABLE_PREFIX."cms_node.setpublish != 0)
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit1
");
while($articleinfo1 = vB::$db->fetch_array($articlegrab1)) {
$title1 = $articleinfo1['title'];
$text1= $articleinfo1['previewtext'];
$nodeid1 = $articleinfo1['nodeid'];
$url1 = $articleinfo1['url'];
$pagetext1 = $articleinfo1['pagetext'];
$unixdate1 = $articleinfo1['publishdate'];
$date1 = date("F j, Y, g:i a", $unixdate1);
$fulltext1 = strip_bbcode($fulltext1);
$text1 = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
$text1 = strip_bbcode($text1);
$pagetext1 = strip_bbcode($pagetext1);
if($text1 == '') $pagetext1 = substr($pagetext1, 0, 120);
$centerhtml1 .="<div style='padding-bottom:10px;margin-bottom:10px; margin-left:8px; margin-right:8px;border-bottom:1px solid #cccccc''>";
$centerhtml1 .="<b><a href='/content.php?".$nodeid1."-".$url1."'>".$title1."</a></b>";
$centerhtml1 .="<p><span style='color:#6f6f6f'>".$date1."</span></p>";
$centerhtml1 .="<p>".$pagetext1."...</p></div>";
}
vB::$db->free_result($articlegrab1);
$tabhtml1 = "<div><ul>".$tabhtml1."</ul>";
echo $tabhtml1.$centerhtml1."</div>";
//
?>