vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Latest post id and thread id on index page (https://vborg.vbsupport.ru/showthread.php?t=40700)

freakyshiat 07-05-2002 03:18 PM

Latest post id and thread id on index page
 
how can I do that?

thanks...

g-force2k2 07-05-2002 03:50 PM

there's a hack for something similar... try searching the hacks database or just the hacks list themselves :D

g-force2k2

freakyshiat 07-05-2002 05:25 PM

theres a hack that counts the posts in a thread, like what is installed at this site ; I guess I need a simple database query that will grab the latest post and thread id and output that on the index page

g-force2k2 07-05-2002 05:49 PM

open index.php

find:

// get total posts

under it add:

PHP Code:

// +++++++ Last Post Thread ID [ Start ] +++++++
$getid=$DB_site->query('SELECT threadid FROM thread ORDER BY lastpost DESC LIMIT 1');
$id=$getid[threadid];
$lastthread="<a href=\"showthread.php?s=$session[sessionhas]&threadid=$id">$id</a>";
// +++++++ Last Post Thread ID [ End ] +++++++ 

then in the forumhome template place [php]$lastthread[/php where you want it to appear... it'll display the number like you were looking for...

i think this'll work but not positive and not sure if this is what you were looking for?

g-force2k2

freakyshiat 07-05-2002 06:22 PM

yeah u have the right idea but its generating a blank index page when I add your code :)

g-force2k2 07-05-2002 06:43 PM

well i'll take a look and repost it in a few... you want the id number though yes? not the name? i'll test it... didn't try i yet...

g-force2k2

Edit: just saw i forgot to block out coding ;\ and you didn't get a parse error?

replace the coding i gave you with this instead:

PHP Code:

// +++++++ Last Post Thread ID [ Start ] +++++++
$getid=$DB_site->query('SELECT threadid FROM thread ORDER BY lastpost DESC LIMIT 1');
$id=$getid[threadid];
$lastthread="<a href=\"showthread.php?s=$session[sessionhas]&threadid=$id\">$id</a>";
// +++++++ Last Post Thread ID [ End ] +++++++ 


Zzed 07-05-2002 06:50 PM

Try this:

PHP Code:

$threadinfo=$DB_site->query_first("select thread.threadid, thread.title, lastpost, lastposter, post.postid from thread left join post on (post.\
threadid = thread.threadid) where forumid = 
$forumid order by postid desc limit 1;");
echo 
"<a href=\"showthread.php?s=$session[sessionhash]&postid=$threadinfo[postdid]#post$threadinfo[postid]\">$threadinfo[title]</a>"


g-force2k2 07-05-2002 07:02 PM

Zzed you forgot to block the quote at the end ;) and i believe that Fazle wants the number not the name ;)

g-force2k2

Zzed 07-05-2002 08:16 PM

LOL @ g-kforce2k2 :D:D:D

And you spelled sessionhash as sessionhas. ;)

freakyshiat 07-05-2002 08:16 PM

Zzed thanks for the help, but yeah I just want the number ; the latest threadid and postid.

g-force2k2, I added the new code but when I add the $lastthread in forumhome, no number comes up ; index page doesnt show up as blank anymore, but the threadid doesnt show up either :)


All times are GMT. The time now is 01:50 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.01121 seconds
  • Memory Usage 1,739KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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