Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2003, 02:01 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Last new posts

i want to show the last 20 posts made on the forum on a seperate page does anyone have an idea on how to do this ??
Reply With Quote
  #2  
Old 09-12-2003, 02:30 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think it will be something like this.
PHP Code:
<?php
error_reporting
(7);
require(
'./global.php');

$latestthread=$DB_site->query_first("SELECT title,threadid,dateline FROM thread ORDER BY dateline desc LIMIT 20");

    echo (
"Latest 20 threads: <br /> <a href=\"showthread.php?s=$session[sessionhash]&amp;threadid=$latestthread[threadid]\">$latestthread[title]</a>");


?>
Untested, should work. If it doesn't, i'll look further into it
Reply With Quote
  #3  
Old 09-12-2003, 03:14 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

u nearly there m8

i get a Warning: Cannot modify header information - headers already sent by (output started

then it shows one new post underneath it
Reply With Quote
  #4  
Old 09-12-2003, 03:17 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok i took out the error reporting bit

and no error now but it only shows one post still
Reply With Quote
  #5  
Old 09-12-2003, 03:31 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try
PHP Code:
<?php 
error_reporting
(7); 
require(
'./global.php'); 

$latestthread=$DB_site->query_first("SELECT title,threadid,dateline FROM thread ORDER BY dateline DESC LIMIT 20"); 

    echo (
"Latest 20 threads: <br /> <a href=\"showthread.php?s=$session[sessionhash]&amp;threadid=$latestthread[threadid]\">$latestthread[title]</a>"); 


?>
Reply With Quote
  #6  
Old 09-12-2003, 03:36 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

same m8

no error but only one latest thread/post is showing
Reply With Quote
  #7  
Old 09-12-2003, 03:49 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$DB_site->query_first() will only return one result, no matter now may rows you tell it to fetch from the DB. You need to use $DB_site->query() and use $DB_site->fetch_array() in a while loop to get more than one item from the DB.
Reply With Quote
  #8  
Old 09-12-2003, 04:46 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NTLDR
$DB_site->query_first() will only return one result, no matter now may rows you tell it to fetch from the DB. You need to use $DB_site->query() and use $DB_site->fetch_array() in a while loop to get more than one item from the DB.
Duh, I am an idiot Thanks Lee

It should be this
PHP Code:
<?php
error_reporting
(7);
require(
'./global.php');

$latestthread=$DB_site->query("SELECT title,threadid,dateline FROM thread ORDER BY dateline DESC LIMIT 20");
    while (
$latestthreads=$DB_site->fetch_array($latestthread)) {
    echo (
"<a href=\"$bburl\showthread.php?s=$session[sessionhash]&amp;threadid=$latestthreads[threadid]\">$latestthreads[title]</a><br /> ");
}

?>
Reply With Quote
  #9  
Old 09-12-2003, 05:02 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

works perfect

can i use <smallfont> in a php file to make text a lot smaller ?
also thanks to assassingod and NTLDR
Reply With Quote
  #10  
Old 09-12-2003, 05:05 PM
lasto lasto is offline
 
Join Date: Jan 2002
Posts: 1,514
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry one final question

i knwo u helped enough but the above is fine but it only gets new threads dont it,how can i do the exact same but for posts.
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 11:09 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04369 seconds
  • Memory Usage 2,261KB
  • Queries Executed 11 (?)
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_php
  • (1)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
  • (1)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
  • (10)postbit_onlinestatus
  • (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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete