Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 09-19-2001 Last Update: Never Installs: 0
 
No support by the author.

Vision 2.1

i promised to reduse the extra queries to 1. in this 1 query, we can get the last post title, last thread title and last icon... so it have a shorter load time...

i still believe my this hack Release is the simplest mode to display the last post titles in Forumhome & Forumdisplay Page, because it dosen't need any action in database, and just modify 2 places in 2 files... furthermore, now the new vision have reduced the load time very much...

many thanks to PPN for his help...

OK, let's go!

1. change index.php and forumdisplay.php:

find in index.php:
PHP Code:
        // prepare template vars
        
if (!$showforumdescription) {
          
$forum['description']='';
        } 
find in forumdisplay.php:
PHP Code:
        // dates
        
if ($forum['lastpost']>0) {
          
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
          
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']); 
below these add:
PHP Code:
        // start last post title hack by cx
        
$lasttitle '';
        
$lasticon '';
        if (
$forumperms['canview']) { 
               
$forum_this $DB_site->query_first("SELECT post.title AS posttitle,thread.title AS threadtitle,post.iconid,icon.title AS icontitle,iconpath FROM thread LEFT JOIN post USING (threadid) LEFT JOIN icon USING (iconid) WHERE post.username='$forum[lastposter]' AND post.dateline=$forum[lastpost]");

            
$lasttitle $forum_this[posttitle];
            if (
$lasttitle == '') {
                
$lasttitle 'Re: '.$forum_this[threadtitle];
            }
            
$lasttitle_raw $lasttitle;

            if (
strlen($lasttitle) > 30) {
                
$lasttitle substr($lasttitle028);
                
$lasttitle .= '..';
            }

            if (
$forum_this[iconid] > 0) {
                
$lasticon "<img src=$forum_this[iconpath] alt=\"$forum_this[icontitle]\" align=absbottom>";
            }
        }
        
// end last post title hack by cx 

2. i have made the post icons display... so change the template forumhome_lastpostby to:

Code:
	<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink"><tr align="right">
		<td nowrap><smallfont>$lasticon <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]" title="Go to last post: $lasttitle_row">$lasttitle</a><br>
		by <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]">$forum[lastposter]</a> @ $forum[lastpostdate] <font color="#666686">$forum[lastposttime]</font>
</smallfont></td>
		<td nowrap> <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><img src="images/lastpost.gif" border="0" alt="Go to last post: $lasttitle_raw"></a></td>
	</tr></table>
DONE!




------------------------------------------------------------------------------
The Older Vision
a PHP+MySQL newbie's bad exercise...
if you find interest in this you can compare it with the last Release...


someone has posted this type hack, but this Release has a little difference. and in the other's release there's some bugs(about the subforums' last post title), now it has been fixed:

1. change index.php and forumdisplay.php:

find in index.php:

// prepare template vars
if (!$showforumdescription) {
$forum['description']='';
}


find in forumdisplay.php:

// dates
if ($forum['lastpost']>0) {
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);


below these add:

// start last post title hack by cx
$forum_this = $DB_site->query_first("SELECT parentlist FROM forum WHERE forumid=$forum[forumid]");
$forum_this_parents = explode(',', $forum_this[parentlist]);
$forum_this_parents_count = count($forum_this_parents);

$forum_sons = $DB_site->query('SELECT parentlist,forumid FROM forum');
while ($forum_son = $DB_site->fetch_array($forum_sons)) {
$forum_parentlist = $forum_son[parentlist];
$forum_parents = explode(',', $forum_parentlist);
$forum_parents_count = count($forum_parents);
if ($forum_parents[$forum_parents_count - $forum_this_parents_count] == $forum[forumid]) {
$forum_son_all[] = $forum_son[forumid];
}
}

if ($forum_son_all != '') {
$forum_sons = implode(',', $forum_son_all);

$lastposttitlex = $DB_site->query_first("SELECT post.title FROM thread,post WHERE thread.forumid IN($forum_sons) AND post.threadid=thread.threadid AND post.visible=1 ORDER BY post.dateline DESC");
$lastposttitle = ''.$lastposttitlex[title];

if ($lastposttitle == '') {
$lastposttitlex = $DB_site->query_first("SELECT title FROM thread WHERE forumid IN($forum_sons) AND visible=1 ORDER BY lastpost DESC");
$lastposttitle = 'RE: '.$lastposttitlex[title];
}

if (strlen($lastposttitle) > 30) {
$lastposttitle = substr($lastposttitle, 0, 28);
$lastposttitle .= '..';
}
}
// end last post title hack by cx


2. change the template forumhome_lastpostby to:

<div align=right><smallfontbr><nobr><a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]" title="turn to last new post">$lastposttitle</a></nobr><br><nobr>$forum[lastpostdate] <font color="#666686">$forum[lastposttime]</font></nobr><br><nobr>by <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]">$forum[lastposter]</a></nobr></smallfont></div>


3. done! easy and funny job

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 09-23-2001, 10:14 AM
Scott MacVicar Scott MacVicar is offline
 
Join Date: Oct 2001
Location: Glasgow, Scotland
Posts: 1,199
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you don't need
$permissions_this = getpermissions($forum['forumid']);

this is already called eariler in the function in the form

just use $forumperms['canview']

so
if ($permissions_this['canview']) {
becomes
if ($forumperms['canview']) {

this hack also runs 3 extra queries per forum, so if you have a large board with say 40 users online and 50 forums. Then thats 6000 extra queries, they would usually only have to run 2000 to get forum info. This will have a large impact on server load.
Reply With Quote
  #13  
Old 09-23-2001, 10:29 AM
bbqfan
Guest
 
Posts: n/a
Default

Quote:
Originally posted by PPN
you don't need
$permissions_this = getpermissions($forum['forumid']);

this is already called eariler in the function in the form

just use $forumperms['canview']

so
if ($permissions_this['canview']) {
becomes
if ($forumperms['canview']) {

this hack also runs 3 extra queries per forum, so if you have a large board with say 40 users online and 50 forums. Then thats 6000 extra queries, they would usually only have to run 2000 to get forum info. This will have a large impact on server load.
yes, u r right...
i have seen your hack and i think it's great.
but i don't like to modify my database...

maybe i can reduce the 3 extra queries to 1...

my hack is just for another choice...
Reply With Quote
  #14  
Old 09-23-2001, 02:12 PM
bbqfan
Guest
 
Posts: n/a
Default

OK the last update codes have been added in the first post.
this will be the final vision----i hope

now just 1 query for 1 forum...
Reply With Quote
  #15  
Old 09-23-2001, 02:47 PM
Freddie Bingham's Avatar
Freddie Bingham Freddie Bingham is offline
 
Join Date: Oct 2001
Posts: 506
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bbqfan please enter your license information into your profile.
Reply With Quote
  #16  
Old 09-26-2001, 11:52 AM
davibou davibou is offline
 
Join Date: Oct 2001
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hello i'm french so excuse me for my bad english!!

I found a bug in your hack

When you repply to a tread if you dont use icon for the repply
nothing appear for the title just Re:

Can you update the hack or found the bug please ??

Or if there is no bug tell me please

This hack is great ....
Reply With Quote
  #17  
Old 09-27-2001, 12:13 AM
bbqfan
Guest
 
Posts: n/a
Default

to freddie: sorry i work for my boss and the license belongs to him... maybe next time i can ask him for this...


Quote:
Originally posted by davibou
hello i'm french so excuse me for my bad english!!

I found a bug in your hack


When you repply to a tread if you dont use icon for the repply
nothing appear for the title just Re:

Can you update the hack or found the bug please ??

Or if there is no bug tell me please


This hack is great ....
to davibou: u r welcome. i m so happy because someone like my hack. and there is 1 bug actually. i have updated the code in the first post
Reply With Quote
  #18  
Old 09-28-2001, 06:27 PM
shadowbreed shadowbreed is offline
 
Join Date: Oct 2001
Posts: 50
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great hack

[edit]
Thought i had a bug my mistake
[/edit]
Reply With Quote
  #19  
Old 08-14-2002, 06:23 PM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you have a typo:
Quote:
$lasttitle_row
should be
Quote:
$lasttitle_raw
?
Reply With Quote
  #20  
Old 08-14-2002, 06:39 PM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this hack work for anyone? I get a blank display?
Reply With Quote
  #21  
Old 05-05-2003, 09:13 PM
sonic3d's Avatar
sonic3d sonic3d is offline
 
Join Date: Jan 2002
Location: Chicago
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does ne1 know how to make it when the last post in the subforum of the parent forum to sumthin?

l8er
sonic
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 10:22 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.04385 seconds
  • Memory Usage 2,325KB
  • Queries Executed 27 (?)
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)bbcode_code
  • (3)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (7)postbit_onlinestatus
  • (11)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_postinfo_query
  • fetch_postinfo
  • 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_imicons
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete