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)

Mark4865 03-06-2011 09:08 AM

does anyone know how I could use this to display recent videos which I created by putting embed code into static pages in sections.

what would I need to change in the code, all help appreciated

Mark4865 03-09-2011 05:37 AM

Using code below I managed to move image to the left and tried to move text to the right but it still appears underneath image instead of next to it, how do I fix this

// Set Your Section ID Here
$section = '1';
// 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 = '150';

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

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

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

$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /></br></right><p>".$text." </p><br />";
}

sandyss 03-16-2011 04:54 PM

HI Guys. I'm New and I'm looking for a plugin that show the lastest article insert into a section.
I tried to use this, but it doesn't go. I want to ask where is the number of section?
I have at the moment 2 section. I must to put the number or the name of my section in "// Set Your Section ID Here $section = '28';"
I want to put this widget in my home page. And I would like to put this widget in orizontal, like it is a footer.
May you help me? Thanks a lot.

Mark4865 03-16-2011 07:57 PM

Hello Sandyss,

to find your section id go to the section and look at the url see below

How do I find my section id?
When clicking on your section you should see something like this:

http://www.domain.com/content.php?11
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'

sandyss 03-17-2011 08:57 AM

Hi Mark!!!
I have antoher problem because I cannot insert php code in a wdiget.
Because when I open agai the widget i see that the code isn't saved.
Why?
I cannt save php code? But I can't understand why!!!

Mark4865 03-17-2011 09:21 AM

Hello,

I am no expert so you are really asking advice from the wrong person but here goes.

When you create a widget you need to then save it and go to configure widget on the right hand side. Remove the exsisting code in the widget that is already in there when you create a new widget and just copy and paste in the new code and save that should be perfect.

sandyss 03-17-2011 09:39 AM

HI Mark. I asked to vbullettin.com directly.
I hope to resolve the problem. This widget is important for my web site

Thaks a lot!!!v :)

sandyss 03-18-2011 11:12 AM

1 Attachment(s)
Hi guys. I need help
FInally i can put php code in my widjet.
I want to know how can i do to see section article divided i three column.
In this moment i see the artcles section in row and not in column.
I attach the screenshot

Mark4865 03-18-2011 11:44 AM

Quote:

Originally Posted by sandyss (Post 2174708)
Hi guys. I need help
FInally i can put php code in my widjet.
I want to know how can i do to see section article divided i three column.
In this moment i see the artcles section in row and not in column.
I attach the screenshot

Hello,

Using your layout manager where have you place the widget, I could be wrong here but it looks like you have it under the main content block instead of on the sidebar. If I am right move it to the sidebar section and see if that fixes your problem.

sandyss 03-18-2011 11:49 AM

1 Attachment(s)
Hi Mark.
Exactly, I placed it under the main content, bacause I need an horizontal widget:
I nees this widget because it reas lastes artcile section.
But graphically I wolud like to be appear like this screenshot I have made with photoshop.
Take a look, please.
May you help me to create one like ths?

Mark4865 03-18-2011 12:17 PM

Sorry cant help I am not a coder so knowledge is very limited

peterkohar 09-05-2011 09:18 AM

hi there,

how to make just link and publish date appear , i don't want to have half of article and images shown in the box/. thanks

MScotti 10-04-2011 10:07 AM

Thank you for your work, but if I want to use a horizontally widget?

Grazie. :up:

dang3rzon3 10-07-2011 07:29 PM

This is my code

Code:

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


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


    $output .= '<center>';
    if($image != '') $output .= "<a href='content.php?".$nodeid."-".$url."'><img src='".$image."' width='".$width."px' height='".$height."px' align='left' /></a><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 />";
}

I have 2 problems:
- links doesn't work because i have installed vbseo
- preview text doesn't appear. I see only title and date....

Anybody can help me?

davide91plus 10-15-2011 09:30 AM

Quote:

Originally Posted by dang3rzon3 (Post 2254446)
I have 2 problems:
- links doesn't work because i have installed vbseo
- preview text doesn't appear. I see only title and date....

Anybody can help me?



I have the same problem, I used the code of the previous post, because the others don't work well, but I don't understand what is the variable that contains the preview of text, or if I do a preview function that cuts the text after a No. number of characters.

Also, how can I change the url to make it work with vbseo?

Thanks :)

MScotti 10-18-2011 10:25 AM

Hi, i change this:
// Set The Height of The Thumbnail Image
$height = '250';
// Set The Width of The Thumbnail Image
$width = '250';

with
// Set The Height of The Thumbnail Image
$height = '50%';
// Set The Width of The Thumbnail Image
$width = '50%';

and it work fine, but with chrome don't resize verticaly, any idea?
Thanks

dang3rzon3 10-18-2011 12:34 PM

Hy MScotti and davide91plus.
Do you find how to work with vbseo?
Do you see the preview text in your script or only title and preview image?

Thanks

MScotti 10-18-2011 12:52 PM

Quote:

Originally Posted by dang3rzon3 (Post 2258560)
Hy MScotti and davide91plus.
Do you find how to work with vbseo?
Do you see the preview text in your script or only title and preview image?

Thanks

- Non ho vbseo
- Anteprima immagine e titolo
- data pubblicazione

dang3rzon3 10-18-2011 01:57 PM

In the code there's

$text = $articleinfo['previewtext'];

How it works?

Anybody can help us?

davide91plus 10-22-2011 08:34 AM

Quote:

Originally Posted by dang3rzon3 (Post 2258579)
In the code there's

$text = $articleinfo['previewtext'];

How it works?

Anybody can help us?

Something new about that?

I'd like to be able to preview the text of articles ... :(

inigo 12-12-2011 07:11 AM

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!

romaszek 02-11-2012 06:36 PM

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


Quote:

Originally Posted by XManuX (Post 2000458)
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?

Preech 03-09-2012 11:21 AM

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>"


monoco 06-05-2012 06:10 PM

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 ?

mmacrypt 06-21-2012 06:48 PM

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.

Preech 06-22-2012 04:07 AM

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.

Preech 01-11-2013 02:30 AM

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.

case-dk 01-26-2013 09:17 AM

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

goxy63 02-18-2013 11:08 PM

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

stefano9lli 06-19-2013 08:18 AM

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

Reef Man 06-20-2013 10:56 PM

Just a question, is there anyway to have on this mod the same image for "read more" that in the rest of my sections?

Reef Man 06-21-2013 06:19 PM

Can I bring the youtube video from my other sections?

Toorak Times 06-23-2013 12:35 PM

Confused??

Which code would I put in my 4.2..1 to make this work please guys?

ArcadeSyndicate 12-05-2015 02:40 PM

very nice and easy to configure :)


All times are GMT. The time now is 11:14 AM.

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.01484 seconds
  • Memory Usage 1,865KB
  • 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
  • (8)bbcode_code_printable
  • (4)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (34)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