vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Widget: Latest Articles In Section (https://vborg.vbsupport.ru/showthread.php?t=232443)

OcR Envy 01-19-2010 09:15 AM

Quote:

Originally Posted by Datenpapst (Post 1957259)
Hi,
whats the 150px image for?
It also seems like that the preview text code does not work :(

Preview Text works fine for me on two of my test boards. Check your source and see paste the HTML the widget enters so I can look at it closer please. The 150px image is the preview image for the article. If you insert and image into the article it will display a thumbnail view of the image. You can change the dimensions if you'd like. 150px just worked for what I was trying to do.

Quote:

Originally Posted by kingMOB (Post 1959737)
OcR Envy, there's a way to print the section, subsection and/or categories from the article in the widget?

Thanks =)

No king not currently.

Quote:

Originally Posted by tazattitude (Post 1959758)
I also got an error.
I changed the section to one of my sections

HTML Code:

Parse error: syntax error, unexpected $end in /usr/www/users/saj716/a_customxxxxxxxxx/forum/packages/vbcms/widget/execphp.php(171) : eval()'d code on line 44
Also, to add, I do have a prefix "vbull"

You must change the sections to match your own section numbers. Make sure you have the number reading like this $section = '115'; 115 would be your own section id but you must have the surrounding ' '; for it to work.

Quote:

Originally Posted by Spiritvn (Post 1959781)
Could u make it automatically get the section ID from the section clicked?

I'm not sure what you mean? Explain more please.

Neptun 01-19-2010 09:59 AM

what section id if have to put in when i want to have articles from the main section - for example at vbulletin.com it is called "the Front page" ? that i get a lot of articles - because i tried the section id and i get nothing displayed ?!

tazattitude 01-19-2010 10:03 AM

Quote:

Originally Posted by OcR Envy (Post 1960027)

You must change the sections to match your own section numbers. Make sure you have the number reading like this $section = '115'; 115 would be your own section id but you must have the surrounding ' '; for it to work.

That's what I mean by
"I changed the section to one of my sections"


PHP Code:

// Set Your Section ID Here
$section '28'// This is a live section on my website (id: 28). Permissions to view granted to all usergroups
// Set The Number of Articles To Display
$limit '3';

$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.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
  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))
  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);  

    
$output .= "<div align='center'>";

    if(
$image != '') {
        
$output .= "<img src='" $image "' width='150px' height='150px' /><br />";
    }

    
$output .= "<a href='content.php?" $nodeid "-" $url "'>" $title "</a><br />";
    
$output .= "<p>Publish Date: " $date "</p></br>";
    
$output .= "<p>" $text " <a href='content.php?" $nodeid "-" $url "'>(more)</a></p></div><br />"


tazattitude 01-19-2010 10:10 AM

Quote:

Originally Posted by Neptun (Post 1960047)
what section id if have to put in when i want to have articles from the main section - for example at vbulletin.com it is called "the Front page" ? that i get a lot of articles - because i tried the section id and i get nothing displayed ?!

You can do this by default...

Admin Panel
Widgets>>Create New Widget >>Choose "General Search" (also name your widget)
Then "save"
Then you need to configure. Choose "Article". Then choose the rest how many days and how many you want to show up.

OcR Envy 01-19-2010 10:43 AM

Quote:

Originally Posted by tazattitude (Post 1960053)
That's what I mean by
"I changed the section to one of my sections"


PHP Code:

// Set Your Section ID Here
$section '28'// This is a live section on my website (id: 28). Permissions to view granted to all usergroups
// Set The Number of Articles To Display
$limit '3';

$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.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
  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))
  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);  

    
$output .= "<div align='center'>";

    if(
$image != '') {
        
$output .= "<img src='" $image "' width='150px' height='150px' /><br />";
    }

    
$output .= "<a href='content.php?" $nodeid "-" $url "'>" $title "</a><br />";
    
$output .= "<p>Publish Date: " $date "</p></br>";
    
$output .= "<p>" $text " <a href='content.php?" $nodeid "-" $url "'>(more)</a></p></div><br />"


And you are getting an error with this code?

Quote:

Originally Posted by tazattitude (Post 1960064)
You can do this by default...

Admin Panel
Widgets>>Create New Widget >>Choose "General Search" (also name your widget)
Then "save"
Then you need to configure. Choose "Article". Then choose the rest how many days and how many you want to show up.

This will show every section though. To show just the front page set $section = '1';

tazattitude 01-19-2010 12:01 PM

Got it to work. No more error
I put in an incorrect section number
:o

Great job!
:D

OcR Envy 01-19-2010 02:58 PM

Quote:

Originally Posted by tazattitude (Post 1960132)
Got it to work. No more error
I put in an incorrect section number
:o

Great job!
:D


Glad to hear it, thanks for marking as installed too! :)

CMerritt 01-19-2010 07:57 PM

I know this isn't available currently, but any thought to setting it up so that individual users could choose the section they want to appear by default? In other words, setting up a widget on the front page that would show articles by section based on their selection?

OcR Envy 01-20-2010 09:14 AM

Quote:

Originally Posted by CMerritt (Post 1960546)
I know this isn't available currently, but any thought to setting it up so that individual users could choose the section they want to appear by default? In other words, setting up a widget on the front page that would show articles by section based on their selection?


Not something I'm going to work on but that's fairly easily done on your end.

Create a User Profile Field, Single Line Textbox.
In the UsersCP have the user enter the Section ID they want to display.
In the widget change $section = ' '; to $section = $bbuserinfo['fieldX']


X would be the Profile Field #. I believe this will work I obviously haven't tested it.

OcR Envy 01-20-2010 11:45 AM

Updated to 1.3 no need to update unless previewtext was not appearing for you.


All times are GMT. The time now is 05:55 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.01212 seconds
  • Memory Usage 1,794KB
  • 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
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete