PDA

View Full Version : Recent article widget help


Jaffery
05-14-2011, 07:33 AM
Hello.
I am unable to locate on forum but I guess it already answered somewhere..

I need a recent article widget for CMS which shows only recent article link.. no description etc..

And image beside article would be best..

Mark4865
05-14-2011, 05:34 PM
Hello I can help with that, try code below, create new php widget.

// Set Your Section ID Here
$section = '120';
// Set The Number of Articles To Display
$limit = '5';
// Set The Height of The Thumbnail Image
$height = '100';
// Set The Width of The Thumbnail Image
$width = '100';

$articlegrab = vB::$db->query_read("
SELECT ".TABLE_PREFIX."cms_nodeinfo.nodeid
, ".TABLE_PREFIX."cms_nodeinfo.title
, ".TABLE_PREFIX."cms_article.previewimage
, ".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.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 ($section))
AND (".TABLE_PREFIX."cms_node.setpublish != 0)
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
");
$output.="<table>";
while($articleinfo = vB::$db->fetch_array($articlegrab)) {

$title = $articleinfo['title'];
$image = $articleinfo['previewimage'];
$nodeid = $articleinfo['nodeid'];
$url = $articleinfo['url'];
$fulltext = strip_bbcode($fulltext);
$text = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
$text = strip_bbcode($text);


if($text == '') $text = substr($fulltext, 0,150);

if($image != '') $output .= "<tr><td><img src='".$image."' width='".$width."px' align='left' height='75' HSPACE='5' VSPACE='3'/></td>";

$output .= "<td><b><a href='content.php?".$nodeid."-".$url."' align='top'>".$title."</a><p>".$text." </b></p><br/></td></tr>";
}
$output.="</table>";

Jaffery
05-16-2011, 04:33 AM
I guess it is to get article from a particular section, what about getting articles from all section?

Mark4865
05-18-2011, 08:41 PM
just add each section no you want seperated by a comma

MScotti
09-29-2011, 08:29 PM
Thanks so much Mark4865, but if I want the same result with "Recent Blog Posts"? ;)

dang3rzon3
10-11-2011, 06:45 PM
the link doesn't work with vbseo installed.

Is it also possible to show the preview text for the article?

The code show only the images and the title of the article...

dang3rzon3
10-15-2011, 09:06 AM
anybody can help me? :(

MScotti
11-07-2011, 10:10 PM
Hello I can help with that, try code below, create new php widget.....code...


Thank you Mark4865 you think is possible add a frame for the image and a preview for the article?

Regards,
Mscotti

Budget101
01-12-2012, 02:32 PM
I love this widget, but I have a question, how would you make the Article title appear below each Image and have the images run horizontally, rather than vertically?

So they appear like this:

https://vborg.vbsupport.ru/external/2012/02/39.jpg

I've been wanting to add this for ages, but can't get it to display quite right! Thanks so much for any assistance :-)

romaszek
02-09-2012, 01:09 PM
I love this widget, but I have a question, how would you make the Article title appear below each Image and have the images run horizontally, rather than vertically?

So they appear like this:

https://vborg.vbsupport.ru/external/2012/02/39.jpg

I've been wanting to add this for ages, but can't get it to display quite right! Thanks so much for any assistance :-)

I was just going to ask the same question.
Somebody will help?