daniel_pet
09-16-2011, 04:37 AM
if (!$output = vB_Cache::instance()->read('offr.myarticles'))
{
$article_count = 5;
$category_name = 'Топ 5';
$sql = "SELECT node.nodeid, node.contenttypeid, node.url, info.title FROM " . TABLE_PREFIX . "cms_node AS node
INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid
INNER JOIN " . TABLE_PREFIX . "cms_nodecategory AS nc ON nc.nodeid = node.nodeid
INNER JOIN " . TABLE_PREFIX . "cms_category AS cat ON nc.categoryid = cat.categoryid
WHERE cat.category = '$category_name' AND setpublish > 0 AND publishdate <= " . TIMENOW . "
ORDER BY publishdate DESC LIMIT $article_count" ;
$rst = vB::$db->query_read($sql);
$output = '';
while($node = vB::$db->fetch_array($rst))
{
$route_info = $node['nodeid'] .
($node['url'] != '' ? '-' . $node['url'] : '');
$node['page_url'] = vB_Route::create('vBCms_Route_Content',
$route_info)->getCurrentURL();
$output .= "<a href=\"" . $node['page_url'] . "\">" . $node['title'] . "</a><br />\n";
}
vB_Cache::instance()->write('offr.myarticles', $output, false, 'articles_updated');
}
I found this and it works very well.
How can I add content and image.
I want to do different designs for headlines
$output .= "<a href=\"" . $node['page_url'] . "\">" . $node['title'] . "</a><br />\n";
$output .= "image medium size" ;
$output .= "content preview";
10X for all.
Daniel
--------------- Added 1316233739 at 1316233739 ---------------
solved 10x
{
$article_count = 5;
$category_name = 'Топ 5';
$sql = "SELECT node.nodeid, node.contenttypeid, node.url, info.title FROM " . TABLE_PREFIX . "cms_node AS node
INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid
INNER JOIN " . TABLE_PREFIX . "cms_nodecategory AS nc ON nc.nodeid = node.nodeid
INNER JOIN " . TABLE_PREFIX . "cms_category AS cat ON nc.categoryid = cat.categoryid
WHERE cat.category = '$category_name' AND setpublish > 0 AND publishdate <= " . TIMENOW . "
ORDER BY publishdate DESC LIMIT $article_count" ;
$rst = vB::$db->query_read($sql);
$output = '';
while($node = vB::$db->fetch_array($rst))
{
$route_info = $node['nodeid'] .
($node['url'] != '' ? '-' . $node['url'] : '');
$node['page_url'] = vB_Route::create('vBCms_Route_Content',
$route_info)->getCurrentURL();
$output .= "<a href=\"" . $node['page_url'] . "\">" . $node['title'] . "</a><br />\n";
}
vB_Cache::instance()->write('offr.myarticles', $output, false, 'articles_updated');
}
I found this and it works very well.
How can I add content and image.
I want to do different designs for headlines
$output .= "<a href=\"" . $node['page_url'] . "\">" . $node['title'] . "</a><br />\n";
$output .= "image medium size" ;
$output .= "content preview";
10X for all.
Daniel
--------------- Added 1316233739 at 1316233739 ---------------
solved 10x