Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Widget: Latest Articles In Section Details »»
Widget: Latest Articles In Section
Version: 1.6, by OcR Envy OcR Envy is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.0.0 Rating:
Released: 01-06-2010 Last Update: Never Installs: 65
Auto-Templates
Re-useable Code Translations  
No support by the author.

Latest Articles In Section

What is does:
vBCMS only has one option for latest articles and that is all sections and categories. This widget will allow you to display the latest articles in a specific section.

Change Log:
1.0 - Initial Release
1.1 - Updated to allow more than one section & display published date.
1.2 - Small update, no need to update unless you are using a table prefix.
1.3 - Added full page text if no previewtext row exists.
1.4 - Updated to not show unpublished articles.
1.5 - Updated read more link to look more vBulletin related.
1.6 - Small change to fix 4.0.2 [ATTACH] showing in text.

Installation:
  • Goto AdminCP-vBullietin CMS-Widgets->Create New Widget
  • Choose PHP Direct Execution as Widget's Type
  • Enter A Title IE: "Latest (Insert Your Section Name Here)"
  • Click Save
  • Click Configure
  • Remove all the default code.
  • Copy and Paste the code below first editing $section and $limit to your liking
  • Click Save
  • Goto AdminCP-vBullietin CMS-Layout Manager
  • Add the Widget to your Layout
  • Click Save
How do I find my section id?
When clicking on your section you should see something like this:
The number after ? in this case 11 is your section id.

Can I enter more than one section id?
Yes simply change $section = '11' to something like $section='11, 12, 13'

Code to copy(make sure you change $section and $limit!)
PHP Code:
// Set Your Section ID Here
$section '11';
// Set The Number of Articles To Display
$limit '1';
// Set The Height of The Thumbnail Image
$height '250';
// Set The Width of The Thumbnail Image
$width '250';

$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.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 ($section))
    AND ("
.TABLE_PREFIX."cms_node.setpublish != 0)
  ORDER BY "
.TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
"
);


while(
$articleinfo vB::$db->fetch_array($articlegrab)) {

    
$title $articleinfo['title'];
    
$image $articleinfo['previewimage'];
    
$text $articleinfo['previewtext'];
    
$nodeid $articleinfo['nodeid'];
    
$url $articleinfo['url'];
    
$unixdate $articleinfo['publishdate']; 
    
$date date("F j, Y, g:i a"$unixdate);  
    
$fulltext strip_bbcode($fulltext);
    
$text preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/'''$text);
    
$text strip_bbcode($text);


   if(
$text == ''$text substr($fulltext0,150);
    
    
$output .= '<center>';
    if(
$image != ''$output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";
    
    
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />";

Preview:



For Category Mod See Here:
https://vborg.vbsupport.ru/showthread.php?t=232440

Screenshots

File Type: png screenshot.PNG (128.1 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
3 благодарности(ей) от:
case-dk, Oxylis, Toorak Times

Comments
  #102  
Old 12-12-2011, 07:11 AM
inigo inigo is offline
 
Join Date: May 2010
Location: Spain
Posts: 102
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have another important question:

How can I take the category name over all the articles listed?

For random categories (the widget title is not a solution)

Thanks!
Reply With Quote
  #103  
Old 02-11-2012, 06:36 PM
romaszek romaszek is offline
 
Join Date: Dec 2007
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry, I don′t get the idea as to connect this code:


Quote:
Originally Posted by XManuX View Post
Note that you can "easily" modify it to have the "best rated articles of this month"

1?) Add this in the SELECTed fields :
Code:
, ".TABLE_PREFIX."cms_nodeinfo.ratingtotal
2?) Add this condition in your request to limit results to the current month (and year) :
Code:
AND (MONTH(FROM_UNIXTIME(".TABLE_PREFIX."cms_node.publishdate))=MONTH(NOW()) AND YEAR(FROM_UNIXTIME(".TABLE_PREFIX."cms_node.publishdate))=YEAR(NOW()))
3?) Replace the ORDER part :
Code:
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
with:
Code:
ORDER BY ".TABLE_PREFIX."cms_nodeinfo.ratingtotal DESC LIMIT $limit
4?) In the While (where all variables are initialized) :
Code:
$rating = $articleinfo['ratingtotal'];
5?) Add somewhere in the $output string definition:
Code:
<span class=\"cmsrating rating{$rating}\"></span>
Regards.
With this code, please for the help.

PHP Code:
// Set Your Section ID Here
$section '11';
// Set The Number of Articles To Display
$limit '1';
// Set The Height of The Thumbnail Image
$height '250';
// Set The Width of The Thumbnail Image
$width '250';

$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.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 ($section))
    AND ("
.TABLE_PREFIX."cms_node.setpublish != 0)
  ORDER BY "
.TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
"
);


while(
$articleinfo vB::$db->fetch_array($articlegrab)) {

    
$title $articleinfo['title'];
    
$image $articleinfo['previewimage'];
    
$text $articleinfo['previewtext'];
    
$nodeid $articleinfo['nodeid'];
    
$url $articleinfo['url'];
    
$unixdate $articleinfo['publishdate']; 
    
$date date("F j, Y, g:i a"$unixdate);  
    
$fulltext strip_bbcode($fulltext);
    
$text preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/'''$text);
    
$text strip_bbcode($text);


   if(
$text == ''$text substr($fulltext0,150);
    
    
$output .= '<center>';
    if(
$image != ''$output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";
    
    
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />";

This works for 4.1.10

Very Thanks
Somebody will help?
Reply With Quote
  #104  
Old 03-09-2012, 11:21 AM
Preech Preech is offline
 
Join Date: Aug 2002
Location: Fort Campbell
Posts: 325
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I figured out how to get the image on the left, and text on the right. It looks better if your title isn't to long.

PHP Code:
 $output .= '<div align="center">';
    if(
$image != ''$output .= "<p><img src='".$image."' align=\"left\" margin-top: 3px margin-bottom: 3px width='".$width."px' height='".$height."px'  style=\"border: solid 3px #DADFCB /><br />";
    
    
$output .= "<span style=\"font-size:11px\"> <a href='content.php?".$nodeid."-".$url."'>".$title."</a></span></p></br><br /><hr class='vbt_line' /></div>"
Reply With Quote
  #105  
Old 06-05-2012, 06:10 PM
monoco monoco is offline
 
Join Date: Dec 2009
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had this mod working fine before the upgrade to 4.1.11 and now the widgets will not show the previewtext.

It will show title, image and if set to the pagetext.

Any idea what the problem could be ?
Reply With Quote
  #106  
Old 06-21-2012, 06:48 PM
mmacrypt's Avatar
mmacrypt mmacrypt is offline
 
Join Date: Feb 2010
Location: Colorado
Posts: 153
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anybody know if this would work with a Group ID, I think I'm going to give it a try but I'm running 4.2 so we shall see what happens.
Reply With Quote
  #107  
Old 06-22-2012, 04:07 AM
Preech Preech is offline
 
Join Date: Aug 2002
Location: Fort Campbell
Posts: 325
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It still works on 4.2 I have changed my code of how it looks. Maybe I'll post it. It helped me alot with longer titles. I just haven't figured out how to get the preview text to show on 4.2.
Reply With Quote
  #108  
Old 01-11-2013, 02:30 AM
Preech Preech is offline
 
Join Date: Aug 2002
Location: Fort Campbell
Posts: 325
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was having issues with vbseo, than I just did this.

PHP Code:
<a href='content.php?".$nodeid."-".$url."'
and changed it to this.

PHP Code:
<a href='/content.php?r=".$nodeid."-".$url."'
Clicking the links seemed to work. Also I am getting my preview text to work as well. There is no demo as of now, because I am still redesigning the look of my website. Sorry and I apologize.
Reply With Quote
  #109  
Old 01-26-2013, 09:17 AM
case-dk case-dk is offline
 
Join Date: Jun 2012
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks to OcR Envy. Works in 4.2.
Just had to insert a piece of code: $fulltext=$articleinfo['pagetext'];
I have my category-ID in the URL and read the string into the widget.
Then i dont have to make a Widget for every category i use.
Greetings
Reply With Quote
  #110  
Old 02-18-2013, 11:08 PM
goxy63 goxy63 is offline
 
Join Date: Oct 2008
Location: its like another planet:D
Posts: 657
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Most of my articles have video instead of image, that is there is no images just youtube video, and with this widget there is no preview of youtube video [scaled] as under primary content I got now in CMS

This widget would be great if I will be able to show scaled youtube video

Thanks
Reply With Quote
  #111  
Old 06-19-2013, 08:18 AM
stefano9lli's Avatar
stefano9lli stefano9lli is offline
 
Join Date: Sep 2009
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fix for VBSeo

Into FTP duplicate content.php (rename it as contents.php) and link it to the new structure

Code:
contents.php?$nodeid
it results like

contents.php?512 => i.e. http://www.inforge.net/community/contentsp.php?518



###########


For previewtext i'm searching for a tweak
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:23 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08794 seconds
  • Memory Usage 2,405KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (7)bbcode_code
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (3)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete