View Full Version : vBulletin CMS Widgets - Widget: Latest Articles In Section
OcR Envy
01-06-2010, 10:00 PM
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 SaveHow do I find my section id?
When clicking on your section you should see something like this:
http://www.domain.com/content.php?11 (http://www.domain.comlist.php/?category/11-MyCategory)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!)
// 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($fulltext, 0,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:
https://vborg.vbsupport.ru/attachment.php?attachmentid=112092&stc=1&d=1265896582
For Category Mod See Here:
https://vborg.vbsupport.ru/showthread.php?t=232440
sisterhood
01-07-2010, 05:57 PM
not working database error
kingMOB
01-07-2010, 07:07 PM
Thank you very much OcR Envy, works perfectly.
Any chance to get one for most viewed and one for most commented articles per sections and/or categories?
=)
OcR Envy
01-08-2010, 09:04 AM
not working database error
What is the database error sisterhood?
Thank you very much OcR Envy, works perfectly.
Any chance to get one for most viewed and one for most commented articles per sections and/or categories?
=)
Sure I could work on that King.
1.2 Updated - Small update for people using a table prefix should resolve any database errors.
sisterhood
01-08-2010, 02:41 PM
my box show nothing id have to change in my id
i use vbseo
OcR Envy
01-08-2010, 03:26 PM
my box show nothing id have to change in my id
i use vbseo
So you aren't getting any database errors just nothing is showing in the widget?
There are other ways to find the Section ID.
Go to your AdminCP-vBCMS-Section Manager.
Hover over the section you want. The link should look like this:
http://www.domain.com/admincp/cms_content_admin.php?do=filter§ionid=116&contenttypeid=17sectionid=116 is the part you'd want 116 would be your section id in this example.
Datenpapst
01-16-2010, 10:57 AM
Hi,
whats the 150px image for?
It also seems like that the preview text code does not work :(
kingMOB
01-18-2010, 11:26 PM
OcR Envy, there's a way to print the section, subsection and/or categories from the article in the widget?
Thanks =)
tazattitude
01-18-2010, 11:48 PM
I also got an error.
I changed the section to one of my sections
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"
Spiritvn
01-19-2010, 12:54 AM
Could u make it automatically get the section ID from the section clicked?
OcR Envy
01-19-2010, 09:15 AM
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.
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.
I also got an error.
I changed the section to one of my sections
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 44Also, 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.
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
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"
// 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
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
That's what I mean by
"I changed the section to one of my sections"
// 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?
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
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
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.
Macindy
01-21-2010, 03:19 PM
Hi dev!
Thanks for this great widget! I think I have found a bug: Also not published articles get catched up by the sql-query. This is not very good :D
Please check this ...
OcR Envy
01-22-2010, 09:53 AM
Hi dev!
Thanks for this great widget! I think I have found a bug: Also not published articles get catched up by the sql-query. This is not very good :D
Please check this ...
Hrmn ok thanks for the heads up I will look into it.
K20A2
01-22-2010, 02:12 PM
can this be modified to just show the latest article in each section? Right now it is show up double on my main page and I am looking to just have a different display for the newest article in each section.
http://www.k-series.com/forum/content.php
It is also showing up in the article itself so I might be doing something wrong. http://www.k-series.com/forum/content.php?674-Skunk2-K-Series-Intake-Manifolds
OcR Envy
01-22-2010, 02:53 PM
can this be modified to just show the latest article in each section? Right now it is show up double on my main page and I am looking to just have a different display for the newest article in each section.
http://www.k-series.com/forum/content.php
It is also showing up in the article itself so I might be doing something wrong. http://www.k-series.com/forum/content.php?674-Skunk2-K-Series-Intake-Manifolds
It's showing twice because you have the section set to your front page. I don't think it's possible to hide the front page section from appearing on the front page.
Maybe bit a bit more clear exactly what you want to show and not show.
K20A2
01-22-2010, 03:03 PM
I am trying to make the latest article in each section and the latest article on the main page show up different. I would like for them to have a larger image and have more a presense on the page than the typical 1x2 column that VB provides.
OcR Envy
01-22-2010, 03:06 PM
I am trying to make the latest article in each section and the latest article on the main page show up different. I would like for them to have a larger image and have more a presense on the page than the typical 1x2 column that VB provides.
This mod won't do that for you sorry :(
The front page will always show your most recent articles there's no way to turn that off as far as I know. This mod is meant to show latest articles in a section outside of the front page. You should be playing with the layout manager and your templates to accomplish what you want.
Updated to 1.5 It will no longer display unpublished articles.
K20A2
01-22-2010, 03:17 PM
been playing around with those without a lot of success, I will keep trying.
Demo16
02-04-2010, 11:35 AM
I like it very much, but I would like to put some div there to use some css in order to make some changes (like floating the img to the left and the text on the right).
There's a way to do this?
Neptun
02-05-2010, 04:57 PM
i get the widget working now
but there are 2 things what i need to know:
1.) when i click on the "(more)" link in the widget - nothing is working i get nothing displayed ?! (i think the problem is with seo - how can i fix this in the widget in the rest of the cms everything is working with seo .. please help :) )
2.) how can i display the showed articels side by side in one row ?!
this would be great if i get this things working ;)
really a great hack ;)
Demo16
02-06-2010, 07:43 AM
I like it very much, but I would like to put some div there to use some css in order to make some changes (like floating the img to the left and the text on the right).
There's a way to do this?
no way to do it?
fer_75
02-06-2010, 03:27 PM
The great thing would be to have the latest articles in the current section automatically detected, without to specify $section = 'x'; ... It would be amazing if $section=current section detected.
Would be this possible ?
iamspookysdaddy
02-07-2010, 11:04 AM
Seems like a mod i need thanks! Is there any way to control what user groups see the widget or not? I would like uno-logged in users to see block with certain articles but if you log in you will not see it.
Please advise....
Neptun
02-07-2010, 05:18 PM
i get the widget working now
but there are 2 things what i need to know:
1.) when i click on the "(more)" link in the widget - nothing is working i get nothing displayed ?! (i think the problem is with seo - how can i fix this in the widget in the rest of the cms everything is working with seo .. please help :) )
2.) how can i display the showed articels side by side in one row ?!
this would be great if i get this things working ;)
really a great hack ;)
CAN SOMEBODY HELP ME WITH THIS 2 POINTS ?!
OcR Envy
02-09-2010, 10:53 AM
I like it very much, but I would like to put some div there to use some css in order to make some changes (like floating the img to the left and the text on the right).
There's a way to do this?
Find:
$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."'>(more)</a></p><br />";
Replace with something like this:
$output .= '<div style="float: right; width:255px;">';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' style="float: left;" /><br />";
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br><p>".$text." <a href='content.php?".$nodeid."-".$url."'>(more)</a></p><br /></div>";
i get the widget working now
but there are 2 things what i need to know:
1.) when i click on the "(more)" link in the widget - nothing is working i get nothing displayed ?! (i think the problem is with seo - how can i fix this in the widget in the rest of the cms everything is working with seo .. please help :) )
2.) how can i display the showed articels side by side in one row ?!
this would be great if i get this things working ;)
really a great hack ;)
1. I would have to know what your vbSEO url structure is. Give me some example links to articles or provide me a link to your website.
2. Remove the <center> calls and make a <table><tr><td> would be easiest. It's just simply HTML :)
The great thing would be to have the latest articles in the current section automatically detected, without to specify $section = 'x'; ... It would be amazing if $section=current section detected.
Would be this possible ?
Hmmn how would this be useful? If they are already in the section it would show the latest articles on the section page?
Seems like a mod i need thanks! Is there any way to control what user groups see the widget or not? I would like uno-logged in users to see block with certain articles but if you log in you will not see it.
Please advise....
At the very top of your widget add:
if($show['guest']) {
And at the bottom add:
}
Neptun
02-09-2010, 05:44 PM
OUTPUT
when i change the <center> to <table><tr><td> - i have no changes .... the articles in the widget have the same style not side by side in one row ....
the code is now - this is everything what i have change in the whole code of the widget from you
if($text == '') $text = substr($fulltext, 0,150);
$output .= '<table><tr><td>';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /></table></tr></td><p>".$text." <a href='content.php?".$nodeid."-".$url."'>(more)</a></p><br />";
}
then i get this output -> see the 1st picture
but it should look like the 2nd picture (after widget.jpg)
SEO URLS
CMS Section Articles List: portal/section/[section_id]-[section_title]-list.html
CMS Section Articles List Pagination: portal/section/[section_id]-[section_title]-page[page].html
this is my url rewrite style for the articles in the cms
DivineMessenger
02-10-2010, 02:50 PM
can this be used to turn all posts from a certain section into articles for my news page on the cms?
OcR Envy
02-10-2010, 03:49 PM
can this be used to turn all posts from a certain section into articles for my news page on the cms?
Eh no, you'll need to use the Promote to Article function.
OUTPUT
when i change the <center> to <table><tr><td> - i have no changes .... the articles in the widget have the same style not side by side in one row ....
the code is now - this is everything what i have change in the whole code of the widget from you
then i get this output -> see the 1st picture
but it should look like the 2nd picture (after widget.jpg)
SEO URLS
CMS Section Articles List: portal/section/[section_id]-[section_title]-list.html
CMS Section Articles List Pagination: portal/section/[section_id]-[section_title]-page[page].html
this is my url rewrite style for the articles in the cms
// 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
");
$output .= '<table><tr>';
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);
if($text == '') $text = substr($fulltext, 0,150);
$output .= '<td><center>';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";
$output .= "<a href='/portal/".$url .'-'.$nodeid."/'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='/portal/".$url .'-'.$nodeid."/'>(more)</a></p></td>";
}
$output .= '</tr></table>';Just a guess on the url rewrite. I actually need the format for your CMS Entry setting in vbSEO.
Neptun
02-10-2010, 08:39 PM
Perfect works good now - but i have a little thing with the text descriptions under the pictures now -> you see it in the attachment ..
There is no space between the text of each displayed articel in the widget - is there de possibility to do a maximum number of charters and the rest with "..." and then the "(more)" function like in the attachment with the number "2" -> this would be great if i can get this output then the widget is perfect ;) - or if this not possible then the "1" would be also good - but "2" would be the best ;)
and how can i change the text size in the description?
Is there a possibility to but the "Read more ->" like in the cms used with the articel previes instead of the "(more)" - thats just a idea to look more professional ... ;)
Thx for your great help ;) i love your widget hack
with the seo i have it working now your idea was right ;)
OcR Envy
02-11-2010, 11:45 AM
There are two solutions to the spacing problem neptun.
You could either add cellpadding="10px" or something to <table> or a style="padding-right:10px;" to the <td>
Or to shrink the text displayed find:
if($text == '') $text = substr($fulltext, 0,150);and edit the 150 to whatever number of characters you'd like. However this might not work if the article is pulling the previewtext from the database it wouldn't be effected by this change.
For the more idea:
find:
(more)</a>change to:
Read More <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a>I like the idea to I'll update the original code :)
Neptun
02-11-2010, 09:05 PM
thanksss that you like my idea ;)
i have changed the code now with the "read more" instead of the "(more) and have put a little center & b to this - a change the text size of the discription - it looks really perfect now
perfect hack ;) now its perfect for me ;) and it looks really professional now ;)
thx for your help ;)
iamspookysdaddy
02-12-2010, 08:27 PM
At the very top of your widget add:
if($show['guest']) {
And at the bottom add:
}
Okay this is very good. This blocks guest from seeing....Can you please advise for code to allow certain user groups to see. Sorry I do not know code but can apply your advice.
Thank you this is a most important modifcation!
Installed and Nominated!:up:
OcR Envy
02-15-2010, 10:32 PM
thanksss that you like my idea ;)
i have changed the code now with the "read more" instead of the "(more) and have put a little center & b to this - a change the text size of the discription - it looks really perfect now
perfect hack ;) now its perfect for me ;) and it looks really professional now ;)
thx for your help ;)
Glad you like it :)
Okay this is very good. This blocks guest from seeing....Can you please advise for code to allow certain user groups to see. Sorry I do not know code but can apply your advice.
Thank you this is a most important modifcation!
Installed and Nominated!:up:
Thanks for the nomination that's unexpected for such a small mod :)
For usergroups you'd do something like this:
if(is_member_of($vbulletin->userinfo, 1, 2, 3)) {
Replace the guest code with that. 1, 2, 3 being the usergroup numbers. This should also work for secondary usergroups :)
iamspookysdaddy
02-18-2010, 01:04 AM
Glad you like it :)
Thanks for the nomination that's unexpected for such a small mod :)
For usergroups you'd do something like this:
if(is_member_of($vbulletin->userinfo, 1, 2, 3)) {
Replace the guest code with that. 1, 2, 3 being the usergroup numbers. This should also work for secondary usergroups :)
The mod is important because the CMS lacks basic needed functionality. It needs to be able to show content for specific user groups without blocking the page and displaying a no permissions screen.
However now I can not get the users or guest to function and it just displays empty box. Not sure why. Can you confirm if you are able to display content or not for specific user groups or guest???
Many thanks!!!
OcR Envy
02-18-2010, 02:01 PM
Are you changing the 1, 2, 3 to match what usergroup id numbers you need?
iamspookysdaddy
02-19-2010, 09:40 AM
Hi,
Yes I have tried changing to user group ideas and cannot get the guest to work either. Widget displays normally with content until I add the additonal code to display to certain groups and then the box is empty.
OcR Envy
02-26-2010, 10:31 AM
Hi,
Yes I have tried changing to user group ideas and cannot get the guest to work either. Widget displays normally with content until I add the additonal code to display to certain groups and then the box is empty.
For those wondering I handled spooky' request privately. It seems that regardless of the conditional statement the widget block will display with blank content.
Usergroup viewing permissions for widgets seem like another obvious function that is lacking in the vbCMS. :(
Updated to 1.6
- 4.0.2 started inserting [ATTACH] into the text fields. Simply add:
$text = preg_replace('/\[ATTACH\=CONFIG\]\d\d\[\/ATTACH\]/', '', $text);
$text = strip_bbcode($text);Before:
if($text == '') $text = substr($fulltext, 0,150);And you should be good to go.
sniranjan
03-07-2010, 01:29 PM
Thanks for the excellent mod.
sniranjan
03-07-2010, 01:55 PM
I have vbseo installed and the links dont seem to work with.
My CMS entry for article is
en/[section_title]/[entry_title]-[entry_id].html
Can you please help with the url of the article
Thanks
sniranjan
03-07-2010, 02:26 PM
I have vbseo installed and the links dont seem to work with.
My CMS entry for article is
en/[section_title]/[entry_title]-[entry_id].html
Can you please help with the url of the article
Thanks
I just got this working with a small change:
replace
$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 />";
with
$output .= "<a href='content.php?r=".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br></center><p>".$text." <a href='content.php?r=".$nodeid."-".$url."'> <img alt='Read More' src='images/cms/read_more-right.png' title='Read More' border='0'></a></p><br />";
Thanks
neudimenxion
03-08-2010, 04:20 AM
hi,
The widget is not working. Already change the section id but the articles seem don't want to appear in the widget. what am i might be wrong?
OcR Envy
03-08-2010, 12:10 PM
hi,
The widget is not working. Already change the section id but the articles seem don't want to appear in the widget. what am i might be wrong?
Kinda Vague problem there. Let me see your widget code and the HTML it outputs.
neudimenxion
03-08-2010, 10:54 PM
Kinda Vague problem there. Let me see your widget code and the HTML it outputs.
Here is my widget code. My section id is 147 and the output is per attached.
// Set Your Section ID Here
$section = '147';
// Set The Number of Articles To Display
$limit = '2';
// 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($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 /><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 />";
}
neudimenxion
03-08-2010, 11:11 PM
Kinda Vague problem there. Let me see your widget code and the HTML it outputs.
hi oCR,
Thanks for your concern. I discover what's wrong with my widget. I tick the Permission Preview in the Display Content setting. After i remove the tick it's working now. :up:
XManuX
03-09-2010, 02:08 PM
Note that you can "easily" modify it to have the "best rated articles of this month"
1?) Add this in the SELECTed fields :
, ".TABLE_PREFIX."cms_nodeinfo.ratingtotal
2?) Add this condition in your request to limit results to the current month (and year) :
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 :
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
with:
ORDER BY ".TABLE_PREFIX."cms_nodeinfo.ratingtotal DESC LIMIT $limit
4?) In the While (where all variables are initialized) :
$rating = $articleinfo['ratingtotal'];
5?) Add somewhere in the $output string definition:
<span class=\"cmsrating rating{$rating}\"></span>
Regards.
kingMOB
03-09-2010, 03:26 PM
Thank you very much XManuX =) Will try it later.
Anyway to output the results in real time? Or at least weekly?
What about modify it to the most viewed articles? =)
justasiam
03-09-2010, 10:36 PM
Is there any way to make this not display the content of the article, just the title with a link?
XManuX
03-10-2010, 08:20 AM
Thank you very much XManuX =) Will try it later.
Anyway to output the results in real time? Or at least weekly?
What about modify it to the most viewed articles? =)
Results are updated each time you refresh the page. Using Ajax to refresh them without reloading the page could be cool but a huge backend would be required ...
To display most viewed instead of most rated, replace this :
, ".TABLE_PREFIX."cms_nodeinfo.ratingtotal
with :
, ".TABLE_PREFIX."cms_nodeinfo.viewcount
Then replace this :
ORDER BY ".TABLE_PREFIX."cms_nodeinfo.ratingtotal DESC LIMIT $limit
with:
ORDER BY ".TABLE_PREFIX."cms_nodeinfo.viewcount DESC LIMIT $limit
Replace:
$rating = $articleinfo['ratingtotal'];
with:
$views = $articleinfo['viewcount'];
And finally replace:
<span class=\"cmsrating rating{$rating}\"></span>
with:
Viewed $views times.
kingMOB
03-11-2010, 08:29 AM
Worked perfectly, both modifications, thanks XManuX =)
kingMOB
03-12-2010, 10:18 PM
I'm trying to modify the:
// Set Your Section ID Here
$section = '11';
so it recognizes the section where it is. Right now I have lots of latest, most popular and most viewed articles widgets for the various sections of my cms. Just one generic of each kind that could recognize the section where it is would make things a lot easier =)
Any help ? =)
rastaX
03-13-2010, 06:05 PM
Is there any way to make this not display the content of the article, just the title with a link?
Thanks for this, very nice. I am interested in doing this as well. I have deleted some code and it is working well, but I hate sloppiness. So if you could show the correct way, I would also appreciate it.
kingMOB
03-13-2010, 06:14 PM
This is the code that prints the title and the link to the article:
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a>
You just need to leave this in the end of the widget:
if($text == '') $text = substr($fulltext, 0,150);
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br />";
}
Wild Bronco
03-15-2010, 02:05 PM
This looks nice.
Could the photo be a link to the Article also?
I think most users would starte by clicking it to see more.
OcR Envy
03-24-2010, 10:28 AM
Good stuff here guys. Thanks for supporting Manu and King, been a bit busy myself.
novabandit
03-25-2010, 12:47 AM
I have this working on my homepage, and it's great!
However, is it possible for this to work in a forum sidebar block?
I removed "Publish Date" line and all text has a center alignment. How can that be fixed?
Neptun
06-01-2010, 07:00 PM
i have a problem ...
i have no space between the pictures there is one directly next to the other and also with the text - there is no space between ....
thx for help
Maybe this will help somebody else (or me in case I made a mistake) but I like to set CMS articles to published at a future date/time and this widget code was still showing those even though they were not published yet. It checks for published but not WHEN it is published. Here is what I used to fix this:
Find:
// Set The Width of The Thumbnail Image
$width = '250';
Add below:
// Set the current day and time
$datenow = strtotime("now");
Find:
AND (".TABLE_PREFIX."cms_node.setpublish != 0)
Add below (before 'ORDER BY'):
AND (".TABLE_PREFIX."cms_node.publishdate < ($datenow))
Worked like a champ boss.
monoco
07-23-2010, 09:30 PM
Any way to make the image auto resize like the "cms article preview", instead of having to input the image size?
Neptun
07-25-2010, 07:55 AM
is there a possiblity to link the pictures also to the articles with a hyperlink ?
thanks
monoco
07-27-2010, 12:35 AM
Would like to be able to float the image to the left and have the text flow around the image like the way the primary content widget works.
Any suggestions??
thanasis1
12-12-2010, 10:58 AM
hello all,
i need some help...
i inserted the code but the widget is empty.
i tried to create a new widget by default "Recent articles" and this is not displayed too.
is there any parameter that i have to edit in order to display the widget content?
i created another one (media library) succesfully but this is still empty.
thank you
Mark4865
02-01-2011, 10:20 AM
Hello,
This widget is exactly what I need, can someone PLEASE help me with exact code needed just to show article title, link and preview image and NOTHING else.
Also I have sections with just video, if I use it in those sections with above requirements will it work???
All help greatly appreciated I am very technically challenged and need serious HELP PLEASE
Mark4865
02-05-2011, 10:46 AM
hello,
I have manageed to remove some of the stuff I didnot want (publish date etc) how do I remove the "read more" image and text from what is left below. I seem to get errors with everything I try
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /></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 />";
}
Mark4865
02-05-2011, 02:46 PM
[QUOTE=OcR Envy;1978198]Find:
$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."'>(more)</a></p><br />";
Replace with something like this:
$output .= '<div style="float: right; width:255px;">';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' style="float: left;" /><br />";
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /><p>Publish Date: ".$date."</p></br><p>".$text." <a href='content.php?".$nodeid."-".$url."'>(more)</a></p><br /></div>";
Hello I tried this and it just came up as an error has anyone else got it to work with the picture on the left and text on the right??
I also only want picture and title to show, everything else removed including read more
HELP PLEASE ANYONE
Mark4865
02-11-2011, 09:22 AM
Will seriously pay someone to help me get this working how I want
ANYONE PLEASE!!
nakedanvil
02-28-2011, 06:18 PM
How do/did you remove publish date?
Mark4865
03-01-2011, 12:59 PM
This is the code I used which removes everything but the title and the picture
// 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 .= '<center>';
if($image != '') $output .= "<img src='".$image."' width='".$width."px' height='".$height."px' /><br />";
$output .= "<a href='content.php?".$nodeid."-".$url."'>".$title."</a><br /></br></center><p>".$text." </p><br />";
}
nakedanvil
03-01-2011, 07:59 PM
Thanks Mark, worked great. Just what I've been looking for.
Mark4865
03-03-2011, 01:41 PM
perfect glad I could actually help someone
Mark4865
03-05-2011, 12:28 PM
Hello,
I have this mod install using above code that I changed a bit to remove everything but thumbnail and title, works fantastically, thanks to orignal coder.
Can anyone tell me how to get the pictures on the left and title on the right using same modified code above PLEASE
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
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
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
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
// 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
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
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
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:
Note that you can "easily" modify it to have the "best rated articles of this month"
1?) Add this in the SELECTed fields :
, ".TABLE_PREFIX."cms_nodeinfo.ratingtotal
2?) Add this condition in your request to limit results to the current month (and year) :
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 :
ORDER BY ".TABLE_PREFIX."cms_node.publishdate DESC LIMIT $limit
with:
ORDER BY ".TABLE_PREFIX."cms_nodeinfo.ratingtotal DESC LIMIT $limit
4?) In the While (where all variables are initialized) :
$rating = $articleinfo['ratingtotal'];
5?) Add somewhere in the $output string definition:
<span class=\"cmsrating rating{$rating}\"></span>
Regards.
With this code, please for the help.
// 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($fulltext, 0,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.
$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.
<a href='content.php?".$nodeid."-".$url."'>
and changed it to this.
<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
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 :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.