Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 11-20-2002, 05:44 PM
waherne waherne is offline
 
Join Date: Oct 2002
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Latest threads hack

Hello,

I have seen a lengthy discussion and praise of some hacks that allow the display of x number of most recent posts on a non-VB web page.

Am I missing something by oversimplying what is involved. My view on life is that it is inefficient to query the underlying database for the last 10 posts each time someone visits your homepage. In addition, searches are a drain on server resources.

My approach would be to set up a text file on my server and write each new post to it and delete the 11th post. I would then have my homepage (index.php) read the text file each time a visitor arrives and present the necessary information accordingly. Data in the text file would be held in 10 rows, an array would be created on reading it, and this would be read out in index.php.

Where new posts require moderator approval, a similar script to update the text file could be installed (writing to the text file when the post was approved).

Is this common sense or am I missing something big?

Willie
Reply With Quote
  #2  
Old 11-21-2002, 09:02 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Both approaches have their own pros and cons:

It's true that reading from a text/html file as a include will not put a burden to your server but disadvantages of this structure would be:
1- You need to hack vb more. Dynamic SQL query does not require any hacking in vb, but so as to create a text file, you have to hack newreply.php and newthread.php. Besides you have to hack other vb files if you want a perfect system (like editpost.php or postings.php). What if users edit their posts, or a Mod deletes it/moves it? So as to keep your text files updated you have to cover all gaps which means you'll do a lot of modifications in your vb code. In Db query method you don't touch your vb files in anyway.

2- You can not get detailed data with a text file include: For example you can not easily display how much that post has been read, replied, rated, subscribed. You just display the post itself. however by dynamically querying the server you can get all data you need from any table you need and the entire data will be very uptodate.

IMO SQL method is much better if you want a handy, functional and uptodate info in your non-vb page. Besides it's not so server intensive as you think if you know what you are doing. For example you can query the database according to the table fields that are indexed or you can create new indexes in your db to increase respond time. To get some recent posts to your main page will require around 5-10 SQL queries in your main page which is quite bearable. Please notice that unhacked vb (ver 2) has around 18 queries in main forum page so your site forum page will create half the query load your forum main page creates in your server.

But if you have a busy/slow MYSQL server or a huge post database, you can consider include method over SQL..
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:27 PM.


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.03135 seconds
  • Memory Usage 2,156KB
  • 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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete