Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 02-20-2001, 07:53 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by wluke
DATELINE is when the thread was created.
perfect, that means we can easily do the hack based on the first post date,, this can be good for news ordering.
Reply With Quote
  #12  
Old 02-21-2001, 12:04 PM
Guest
 
Posts: n/a
Default

Could you post the source you used for that original hack ? I really like it
Reply With Quote
  #13  
Old 02-21-2001, 01:59 PM
Guest
 
Posts: n/a
Default

I will post it later today. Sorry, I've been really busy at work.
Reply With Quote
  #14  
Old 02-21-2001, 07:15 PM
Guest
 
Posts: n/a
Default

Quote:
<?php

require("global.php");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db("$dbname");

?>

<table cellpadding="4" cellspacing="1" width="100%">
<tr>
<td><small><strong>MOST VIEWED MESSAGES FROM THE PAST 7 DAYS</strong></small></td>
<td align="center"><small><strong>REPLIES</strong></small></td>
<td align="center"><small><strong>VIEWS</strong></small></td>
</tr>
<?php
$mostviewed = most_viewed();
while( $row = mysql_fetch_row($mostviewed) )
{
print('<tr>');
print('<td>');
print('<a href="showthread.php?s=&threadid=');
print($row[0]);
print('" target="_top">');
print($row[1]);
print('</a></td>');
print('<td align="center">');
print($row[2]);
print('</td>');
print('<td align="center">');
print($row[3]);
print('</td>');
print('</tr>');
}
mysql_free_result ($mostviewed);
?>
</table>

<?php

function most_viewed()
{
$cur_time = mktime(date(G), date(i), date(s), date(m), date(d), date(Y));
$query = 'SELECT threadid, title, replycount, views ' .
'FROM thread ' .
'WHERE (' . $cur_time . '-lastpost) < 604800 ' .
'ORDER BY views DESC LIMIT 10';
$result = mysql_query($query)
or die('most_viewed query failed');
return($result);
}

?>
Here you go. I took out most of the formatting tags so that you can put in your own to make it look the way you want. Put this file into same folder as global.php and let me know how it goes. :P
Attached Files
File Type: txt popular.php.txt (1.5 KB, 137 views)
Reply With Quote
  #15  
Old 02-21-2001, 07:54 PM
Guest
 
Posts: n/a
Default

Ir rulez man !

Just a question , I try to adjust the fonts to size=1 that works with everything except for this part

print('<tr>');
print('<td>');
print('<font size=1><a href="showthread.php?s=&threadid=</font>');
print($row[0]);
print('" target="_top">');
print($row[1]);
print('</a></td>');
print('<td align="center">');
print($row[2]);
print('</td>');
print('<td align="center">');
print($row[3]);
print('</td>');
print('</tr>');

Where sould I add <font size=1> etc ... ? I know it's easy , but I'm not really a php wizard

Thanks for the GREAt script

ps:Is it possible to make the script rank them by most REPLIES instead of VIEWS or is that too hard ?
anywayz ,it rox allready !

GOOD JOB IRC

Thanks
Reply With Quote
  #16  
Old 02-21-2001, 08:32 PM
Guest
 
Posts: n/a
Default

To have it order by replies, you can change the line:

'ORDER BY views DESC LIMIT 10';
to
'ORDER BY replycount DESC LIMIT 10';

Put the font tags here:

print('<tr>');
print('<td><font size="1">');
print('<a href="showthread.php?s=&threadid=');
print($row[0]);
print('" target="_top">');
print($row[1]);
print('</a></font></td>');
print('<td align="center"><font size="1">');
print($row[2]);
print('</font></td>');
print('<td align="center"><font size="1">');
print($row[3]);
print('</font></td>');
print('</tr>');
Reply With Quote
  #17  
Old 02-22-2001, 03:28 PM
Guest
 
Posts: n/a
Default

Something else first , do I add the able border/color options at the same spots you add the font tags ?

Now the serious question , I posted earlier that I need this kind of hack , but for the TOP POSTER (so not a link to a certain post) So just a list that shows us who are the top 3 posters on the forum

Something like this

TOP POSTERS

UserA 188 POSTS
USERB 150 POSTS
UserC 100 POSTS
Reply With Quote
  #18  
Old 02-22-2001, 03:44 PM
Guest
 
Posts: n/a
Default

It shouldn't be too hard to get something that does what you want. I will work take a look at doing that for you.

As for where to put various formatting tags for the table. For tags that affect the whole table like cellpadding and border size, put them in the <table> tag. For the bgcolor or alignment of individual cells, put them in the <td> tags.

I would consult a source on HTML. Once you know where to put a tag if the file was purely HTML, it is usually easy to find out where to put in a PHP file.
Reply With Quote
  #19  
Old 02-22-2001, 04:01 PM
Guest
 
Posts: n/a
Default

Here you go. Again I have stripped out most of the formatting stuff so you can add your own specificiations.

Quote:
<?php

require("global.php");

$db_link = @mysql_pconnect("$dbservername", "$dbusername", "$dbpassword");
mysql_select_db("$dbname");

?>

<table cellpadding="4" cellspacing="1" width="100%">
<tr>
<td><small><strong>TOP POSTERS</strong></small></td>
<td align="center"><small><strong>POSTS</strong></small></td>
</tr>
<?php
$top_post = top_posters();
while( $row = mysql_fetch_row($top_post) )
{
print('<tr>');
print('<td>');
print('<a href="member.php?s=&action=getinfo&userid=');
print($row[0]);
print('" target="_top">');
print($row[1]);
print('</a></td>');
print('<td align="center">');
print($row[2]);
print('</td>');
print('</tr>');
}
mysql_free_result ($top_post);
?>
</table>

<?php

function top_posters()
{
$cur_time = mktime(date(G), date(i), date(s), date(m), date(d), date(Y));
$query = 'SELECT userid, username, posts ' .
'FROM user ' .
'ORDER BY posts DESC LIMIT 3';
$result = mysql_query($query)
or die('top_posters query failed');
return($result);
}

?>
Remember, the file must be residing in the same folder as global.php to work correctly. Also, take off the .txt at the end when you put in on the server.
Attached Files
File Type: txt toppost.php.txt (1.2 KB, 37 views)
Reply With Quote
  #20  
Old 02-22-2001, 04:05 PM
Guest
 
Posts: n/a
Default

Of course as soon as I post it I realize that there is an unnecessary line of code in it. Delete this line:

$cur_time = mktime(date(G), date(i), date(s), date(m), date(d), date(Y));
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:46 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06039 seconds
  • Memory Usage 2,259KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete