vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vBadvanced CMPS - News Digest Module 1.02 (https://vborg.vbsupport.ru/showthread.php?t=70116)

Michael Morris 10-10-2004 07:26 PM

Quote:

Originally Posted by LPH2004
This is gorgeous but how do I only get 2 days worth ... and not a whole HUGE string of days ... ?

I'm installing it on www.whatisnew.com

The last part of the newsdigest.php file is the looks like this.

PHP Code:

if ($vba_options['portal_news_forumid'])
    {
    
$timespan 'thread.dateline>UNIX_TIMESTAMP(CURDATE())';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-1)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-1) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-2)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-2) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-3)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-3) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-4)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-4) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-5)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-5) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-6)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-6) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-7)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-7) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-8)';
    
construct_newsdays(); 
    } 

The first line checks for any news posts made prior to the current date in case there's a glitch in the timestamp of the news item that puts it in the future it will still display. Each line that follows is one day. So, simply trim it down to the number of desired iterations. Two days would read...

PHP Code:

if ($vba_options['portal_news_forumid'])
    {
    
$timespan 'thread.dateline>UNIX_TIMESTAMP(CURDATE())';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-1)';
    
construct_newsdays();
    
$timespan 'thread.dateline<UNIX_TIMESTAMP(CURDATE()-1) AND thread.dateline>UNIX_TIMESTAMP(CURDATE()-2)';
    
construct_newsdays();
    } 

I've tried a couple of times now to get this to work as a while loop but so far nothing gets displayed when I try it that way :(

LPH2004 10-10-2004 07:42 PM

Thank you for the very fast response !

Now, it is starting to take shape by showing just 2 days.

However, it is showing up to 18 stories from the same category. I've looked where to change this to just up to 5 but I'm not sure. The story length cut down to 100 causes some of the stories to have all of the text linked/underlined. I've set it to 200 and stories are all red past a certain point.

Any ideas?

Michael Morris 10-10-2004 08:06 PM

Quote:

Originally Posted by LPH2004
Thank you for the very fast response !

Now, it is starting to take shape by showing just 2 days.

However, it is showing up to 18 stories from the same category. I've looked where to change this to just up to 5 but I'm not sure. The story length cut down to 100 causes some of the stories to have all of the text linked/underlined. I've set it to 200 and stories are all red past a certain point.

Any ideas?

The line limiter is rather dumb, and it won't close tags. What do you want the limit on stories within a category to be?

LPH2004 10-10-2004 08:24 PM

Quote:

Originally Posted by Michael Morris
The line limiter is rather dumb, and it won't close tags. What do you want the limit on stories within a category to be?

Well, I decided to create Frontpage news forums for the major categories and then will make sure they do not exceed 500. They'll say something like "discuss this here" kinda posts.

I've updated the front of www.whatisnew.com now and am adding more of these "news" forums for each category.

Michael Morris 10-10-2004 08:29 PM

Quote:

Originally Posted by LPH2004
Well, I decided to create Frontpage news forums for the major categories and then will make sure they do not exceed 500. They'll say something like "discuss this here" kinda posts.

I've updated the front of www.whatisnew.com now and am adding more of these "news" forums for each category.

Ok. Well, have fun with it and let me know if anything major crops up. I'm going to be working primarily on a Reviews database extention for vbulletin that allows users to post book reviews and look up product and product line information by publisher -though I'll try to keep if flexiable enough for any kind of reviews application. Part of that hack is translating a home-made program someone else wrote into a format vbulletin can deal with :\

Signing off now, and have a good day.

Jaxx 10-28-2004 06:08 AM

Thanks a bunch.

I very pleased with it, you did a great job on it.

Is there any chance of getting some type of mod that would count the replies to a news article and put (# comments) next to it?

*edit*
Now that brings up, how would you moderate the new thread, but not the replies?

Michael Morris 10-28-2004 07:12 AM

I think you can set up a forum so that only new threads are moderated and not new posts without performing any hacks.

Anyway, ENWorld runs an archive of news items by using vbulletin's syndicator - it shows the 20 most recent news items for each topic. To add one to go with this system create a new page, turn all modules off on that page and point it's custom content at a new template (I used adv_portal_headlines)

The content for us is...

HTML Code:

<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="tborder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr><td class="tcat" align="center">Headline Summary Page</td></tr>
</table></td></tr></table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
                <td width="33%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="tborder">
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Site News</td></tr>
          <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=162&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Software</td></tr>
          <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=179&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Community</td></tr>                       
          <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=178&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>       
                </td></tr></table></td>
                <td width="34%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="tborder">
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Official WotC</td></tr>
          <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=164&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Books &amp; Novels</td></tr>                       
                                  <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=180&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Other</td></tr>                       
<script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=181&type=js"></script>
<script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>                       
                        </table>
                </td></tr></table></td>
                <td width="33%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="tborder">
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">D20/OGL</td></tr>
          <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=163&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">PDF/e-publishing</td></tr>
          <script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=111&type=js"></script>
          <script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>
                        <table width="100%" border="0" cellspacing="2" cellpadding="1">
                                <tr><td align="center" class="thead">Sci-Fi/Fantasy</td></tr>
<script type="text/javascript" src="http://www.enworld.org/forums/external.php?forumids=110&type=js"></script>
<script type="text/javascript">
<!--
var max = 10;
if(threads.length < max) max = threads.length;
for(i = 0; i < max; i++)
{
if (threads[i].title.length >
45)
{ threads[i].title = threads[i].title.substring(0, 45) + '...'; }
document.writeln("<tr><td class=\"alt2\"><a href=\"http://www.enworld.org/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a></td></tr>");
}
//-->

</script>
                        </table>                       
                </td></tr></table></td>
        </tr>
</table>
<br />
  <div align="center"><a href="http://www.enworld.org/forums/news.php?page=syndicate">Click here
    to syndicate these headlines</a>.</div>
<br />

Note that there's really not that much fancy going on here if you know HTML. The javascript uses the syndicator to fetch the headlines, and I carefully inserted the classes I wanted into each table row and header to get their colors to display right.

For this to work on your page you have to go to vboptions >> syndication and turn it on, choosing XML syndication. At that point a link will appear in each forum "Syndicate this page" Follow this instructions that appear.

If you need any help just yell.

Michael Morris 10-28-2004 07:34 AM

Quote:

Originally Posted by Jaxx
Thanks a bunch.

I very pleased with it, you did a great job on it.

Is there any chance of getting some type of mod that would count the replies to a news article and put (# comments) next to it?

Easy enough. Open the provided newsdigest.php file. Find this code (It's almost at the start):

PHP Code:

SELECT thread.threadid

IMMEDIATELY AFTER INSERT
PHP Code:

replycount

The query should read like this after you're done

PHP Code:

SELECT thread.threadidreplycountpostusernamepostuserid

and so on.

Doing that captures the reply count. You can now slip it into the news item by putting $news[replycount] into the template. For example, change the adv_portal_newsdigest_item template to:

HTML Code:

<div align="justify">$news[message] - submitted by $news[postusername]. <a href="showthread.php?t=$news[threadid]">Comments: $news[replycount]</a></div>

Jaxx 10-28-2004 07:43 AM

Thanks a bunch. :)

I ran across this though after doing the above. Sorry to be a bother, still relatively new to php.


Code:

Database error in vBulletin 3.0.3:

Invalid SQL:
                        SELECT thread.threadid, replycount, postusername, postuserid, thread.dateline AS postdateline,
                        thread.forumid, forum.title as title, forum.fhbanner as icon, post.postid, pagetext, allowsmilie
                        FROM thread AS thread
                        LEFT JOIN post AS post ON (post.postid = thread.firstpostid)
                        LEFT JOIN forum AS forum ON (forum.forumid = thread.forumid)       
                        LEFT JOIN deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread')
                        WHERE thread.dateline>UNIX_TIMESTAMP(CURDATE()) AND thread.forumid IN(45,46,42,43,44)
                        AND thread.visible = 1 AND thread.open != 10 AND deletionlog.primaryid IS NULL
                        GROUP BY post.postid
                        ORDER BY forum.displayorder
mysql error: Column: 'replycount' in field list is ambiguous

mysql error number: 1052

Date: Thursday 28th of October 2004 04:52:27 AM
Script: http://www.ahazi.org/forums/showthread.php?p=53981
Referer: http://www.ahazi.org/forums/editpost.php?do=editpost&p=53981


Michael Morris 10-28-2004 07:56 AM

No problem :)


All times are GMT. The time now is 07:02 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.01355 seconds
  • Memory Usage 1,854KB
  • 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
  • (5)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete