vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Recent article widget help (https://vborg.vbsupport.ru/showthread.php?t=263623)

Jaffery 05-14-2011 07:33 AM

Recent article widget help
 
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

Quote:

Originally Posted by Mark4865 (Post 2195668)
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

Quote:

Originally Posted by Budget101 (Post 2286932)
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?


All times are GMT. The time now is 07:03 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01167 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete