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-06-2010 10:00 PM

Widget: Latest Articles In Section
 
1 Attachment(s)
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:

https://vborg.vbsupport.ru/attachmen...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

Quote:

Originally Posted by sisterhood (Post 1949790)
not working database error

What is the database error sisterhood?

Quote:

Originally Posted by kingMOB (Post 1949856)
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

Quote:

Originally Posted by sisterhood (Post 1950405)
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:
Code:

http://www.domain.com/admincp/cms_content_admin.php?do=filter&sectionid=116&contenttypeid=17
sectionid=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

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"

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

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.

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

Quote:

Originally Posted by Macindy (Post 1962436)
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/conten...take-Manifolds

OcR Envy 01-22-2010 02:53 PM

Quote:

Originally Posted by K20A2 (Post 1963409)
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/conten...take-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

Quote:

Originally Posted by K20A2 (Post 1963482)
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

Quote:

Originally Posted by Demo16 (Post 1974599)
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

Quote:

Originally Posted by Neptun (Post 1975510)
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

Quote:

Originally Posted by Demo16 (Post 1974599)
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:

PHP Code:

    $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:

PHP Code:

    $output .= '<div style="float: right; width:255px;">';
    if(
$image != ''$output .= "<img src='".$image."' width='".$width."px' height='".$height."px' style="floatleft;" /><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>"

Quote:

Originally Posted by Neptun (Post 1975510)
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 :)

Quote:

Originally Posted by fer_75 (Post 1976082)
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?

Quote:

Originally Posted by iamspookysdaddy (Post 1976566)
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:
PHP Code:

if($show['guest']) { 

And at the bottom add:
PHP Code:




Neptun 02-09-2010 05:44 PM

1 Attachment(s)
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

Quote:

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

Quote:

Originally Posted by DivineMessenger (Post 1979162)
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.


Quote:

Originally Posted by Neptun (Post 1978461)
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


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


$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($fulltext0,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

1 Attachment(s)
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:
PHP Code:

if($text == ''$text substr($fulltext0,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:

PHP Code:

(more)</a

change to:

PHP Code:

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


All times are GMT. The time now is 04:18 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.01665 seconds
  • Memory Usage 2,011KB
  • 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_code_printable
  • (2)bbcode_html_printable
  • (11)bbcode_php_printable
  • (26)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
  • (40)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