PDA

View Full Version : [RELEASE 1.0 beta] LAST THREAD NAME


07-20-2001, 10:00 PM
Deutsch
Diese Hack zeigt auf der index.php unter dem username der das letzte posting gemacht hat auch den titel des threads auf dem dieser das reply geschrieben hat!

English
This hack showes the thread title in the "Last Post" col.

Information
[Version nummer] maybe 1.0 beta
[Files to change] index.php and forumhome_lastpostby template

Installation

== in index.php ==
find:

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


below that add:

$lastposttitle = $DB_site->query("SELECT title FROM thread WHERE forumid='$forum[forumid]' ORDER BY lastpost DESC");
$lastposttitle = $DB_site->fetch_array($lastposttitle);
$lastposttitle = $lastposttitle[title];
if (strlen($lastposttitle) > 20) {
$lastposttitle = substr($lastposttitle,0,18);
$lastposttitle .= "..";
}


== in forumhome_lastpostby template ==
find:

<a href="member.php3?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a>

und this add:

<br><a href="showthread.php3?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><b>$lastposttitle</b></a></a></smallfont></td>


thats all folk

have phun!

ztsky
07-21-2001, 11:08 AM
Very very cool!
You have done a difficult thing so easy.
congratulations!;)

maverick1236
07-21-2001, 01:58 PM
any way I can show the last post title under the last thread title??
TIA!!

ztsky
07-21-2001, 03:24 PM
Works well,but....
BUG~
If i have two sub-forum like b and c in main forum.
Use this hack,If I post a new thread in forum b ,but the lastitle in forum home page is remain the title of the newest thread title in main forum

somnium
07-22-2001, 04:21 PM
i didn't test it with subforums.

perhaps i debug the hack, but i don't know.

ztsky
07-22-2001, 04:22 PM
Originally posted by somnium
i didn't test it with subforums.

perhaps i debug the hack, but i don't know.

How to fix it?
I tried ti fix it yestoday,but nothing can do.

somnium
07-22-2001, 06:08 PM
i don't know how to debug but i think there must be an answer!!

you can hack everythin you want!!!

EXCHANGE
07-28-2001, 03:31 PM
I changed the Code a little bit.
The Thread titles now are only displayed to users who can view the forum the last post is in.

//start get last thread title from forums
$lastposttitle = $DB_site->query("SELECT title FROM thread WHERE forumid='$forum[forumid]' ORDER BY lastpost DESC");
$lastposttitle = $DB_site->fetch_array($lastposttitle);
$lastposttitle = $lastposttitle[title];
$has_access=getpermissions($forum[forumid]);
if (!$has_access['canview']) {
$lastposttitle='';
}
else
{
if (strlen($lastposttitle) > 20) {
$lastposttitle = substr($lastposttitle,0,18);
$lastposttitle .= "..";
}
}
//end get last thread title from forums

somnium
07-28-2001, 09:33 PM
many thx for that!!!

EXCHANGE
07-29-2001, 09:10 AM
Another thing.
There is a Problem when moving a thread and leave a link in another forum.
So here is another fix:
//start get last thread title from forums
$lastposttitle = $DB_site->query("SELECT iconid,title FROM thread WHERE forumid='$forum[forumid]' AND open!='10' ORDER BY lastpost DESC");
$lastposttitle = $DB_site->fetch_array($lastposttitle);
$threadicon = $lastposttitle[iconid];
$lastposttitle = $lastposttitle[title];

$has_access=getpermissions($forum[forumid]);
if (!$has_access['canview']) {
$lastposttitle='';
}
else
{
if ($threadicon > 0) {
$icon="<img src=\"images/icons/icon$threadicon.gif\">";
}
else {
$threadicon=1;
$icon="<img src=\"images/icons/icon$threadicon.gif\">";
}
if (strlen($lastposttitle) > 20) {
$lastposttitle = substr($lastposttitle,0,18);
$lastposttitle .= "..";
}
}
//end get last thread title from forums

I also included the Thread icons, so change forumhome_lastpostby template to this:

<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink">
<tr align="right">
<td nowrap rowspan="2">$icon</td>
<td nowrap><smallfont><a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><b>$lastposttitle</b></a></smallfont></td>
<td nowrap rowspan="2">&nbsp;<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><img src="images/lastpost.gif" border="0" alt="Go to last post"></a></td>
</tr>
<tr align="right">
<td nowrap><smallfont>$forum[lastpostdate] <font color="#666686">$forum[lastposttime]</font><br>
von <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a></smallfont></td>
</tr>
</table>

adrianmak
07-30-2001, 01:12 AM
May i get a final hack ?

Thanks:D

EXCHANGE
07-30-2001, 07:29 AM
I would'nt call it final but the Code in my last post is all you need to install it.
Put the PHP Code into index.php and forumdisplay.php after
// prepare template vars
if (!$showforumdescription) {
$forum['description']='';
}

With the second Part of Code replace the template forumhome_lastpostby.

Fryzid
07-30-2001, 09:26 AM
In EXCHANGEs code add$fulltitle = $lastposttitle;after$lastposttitle = $lastposttitle[title];and then change the threadname link to <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]" title="$fulltitle"><b>$lastposttitle</b></a>Then you have the full title in a popup box.

Mark Hewitt
08-07-2001, 11:24 AM
Any change of a mod for this so it will take thread titles correctly from sub forums.

Or someone in the know giving me a clue so I can make the modifications myself?

handheld234
08-12-2001, 01:36 PM
I put this one in my site as EXCHANGE detailed and it works great. Just had to make one little change for an English site, in the forumhome_lastpostby template I used this instead-\\

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

All i did was change "von" to "by" so the message reads that it is by someone, not von someone. Otherwise thanks a million for this!

EXCHANGE
08-12-2001, 03:59 PM
Thx is missed that when putting it back to english :)

dwh
08-24-2001, 09:05 AM
My icons are coming out wrong. for example icon7.gif points to icon14.gif??

Also why the need to add any code to forumdisplay.php??

Afterburner
08-24-2001, 10:00 AM
@ somnium

:p I made the same hack (LastTitleHack (http://www.vbulletin.com/forum/showthread.php?s=&threadid=22881)) some days before :p
you can turn it off for each board of your choise (e.g. private board) in your CP
maybe we shall work together the next time ;)

EXCHANGE
08-24-2001, 12:09 PM
Originally posted by dwh
My icons are coming out wrong. for example icon7.gif points to icon14.gif??

Also why the need to add any code to forumdisplay.php??

The Code in forumdisplay is just in case you have subforums.

dwh
08-24-2001, 05:28 PM
Thanks. BTW I figured out the problem. For some people I guess it won't affect them depending on the names chosen for the icons but the code was wrong for me and I had to redo it. Also streamlined a couple of things. Busy today but I can post my version of it if someone needs it.

webhost
08-25-2001, 03:55 PM
Has anyone figured out how to have the last title also show up on sub-forums? I have 3 to 4 levels deep on some and this would really help.

webhost
08-28-2001, 06:56 AM
Ok I have installed this on my board I used the instuctions from the first thread in this post by somnium
Here is what I have and the problems or bugs I have with it.

First I had a main forum with sub forums under it. The main forum of this was not open for threads but all subforums under it was. With this setup and by using the script changes by somnium nothing showed up in the last post column showing the last thread of the this forum and subforums. So I went back and made the main forum of this set along with all subforums under it open for posts. By doing this it resolved the problem now the last post shows up. Now this is what I get when I open my board and look at this forum with sub-forums and you see the last post for example say yesterday's news you click on it and it opens say example the thread called todays news . you look at the 2 threads and yesterdays news is in the main forum and todays news is in a subforum,since todays news is newer it is the last thread but since it is in a subforum the title does not show up but yesterday's news does because it is in the main forum. Any fix for this? llok in my signature and go to my board and go forums at the bottom and click on last post and you will see the problem. Thanks any help would be appreciated.

Joey

webhost
08-29-2001, 06:16 PM
[B]EXCHANGE[B/]

Can you help with this the subforms are driving me crazy. I read the thread over and over and I see where you mentioned something about this below.
Originally posted by dwh
My icons are coming out wrong. for example icon7.gif points to icon14.gif??

Also why the need to add any code to forumdisplay.php??

All main forums work great it is just the subforms can you someone pleasehelp me with this?

dwh
08-29-2001, 06:59 PM
kinda busy now but to give you a clue in his code he just pointed to the iconidnumber .gif instead of using iconpath. Using phpmyadmin browse the table icon, you'll see there's a whole path there, you need to get the path info from the sql select statement then point to that instead of the iconidnumber.

webhost
08-29-2001, 07:45 PM
this is all I have done
Installation

== in index.php ==
find:


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


below that add:

$lastposttitle = $DB_site->query("SELECT title FROM thread WHERE forumid='$forum[forumid]' ORDER BY lastpost DESC");
$lastposttitle = $DB_site->fetch_array($lastposttitle);
$lastposttitle = $lastposttitle[title];
if (strlen($lastposttitle) > 20) {
$lastposttitle = substr($lastposttitle,0,18);
$lastposttitle .= "..";
}


== in forumhome_lastpostby template ==
find:

<a href="member.php3?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a>

und this add:


<br><a href="showthread.php3?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><b>$lastposttitle</b></a></a></smallfont></td>

dwh
08-29-2001, 08:02 PM
Oh, I thought you had icon problems didn't read thru everything. I don't use subforums. I think they're too complicated somehow and confusing which template matches what and it messes me up no matter how much I fiddle so I gave up for now. If I knew the table structure for them I'd try to help you but not sure how the table structure looks so impossible to answer you. Maybe somone who uses it will come in and help;

webhost
08-29-2001, 08:07 PM
dwh

Think we might have the fix, we are having to change around
the way you use a subform. Forum verus Cateorgy, I think it will
work we have 3 working already.

Thanks for responding

handheld234
08-31-2001, 02:23 AM
Be sure to use that updated forumhome_lastpostby template he posted [and I copied with one small change for English]. It is important.

EXCHANGE
09-01-2001, 07:30 PM
So here is another fix. Now the link of the last thread name brings you to the post ist belongs to ;) (error came with subforums). Also titles of moderated and not yet approved posts are not shown anymore.

LuBi
09-04-2001, 05:43 AM
How can I move my icon over off the text a bit? Below is my forumhome_lastpostby:

<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink">
<tr align="right">
<td nowrap rowspan="2">$icon</td>
<td nowrap><smallfont><a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><b>$lastposttitle</b></a> (<a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a>)</smallfont></td>
</tr>
<tr align="right">
<td nowrap><smallfont>$forum[lastpostdate] <font color="#666686">$forum[lastposttime]</font></td>
</tr>
</table>

Here is a link to my forums index so you can view my problem. (http://www.suprascene.com/forums/)

handheld234
09-04-2001, 06:00 PM
It looks like you are only having troubles with Netscape. I am having that as well. I don't think it is due to the forumhome_lastpostby template, but rather the width of the Last Post column itself. [if you notice it loads at one width and then must enlarge as it fills the posts in, so the trick is to get it to load at the proper width the first time!]

If you can increase that, then your trouble should go away.

LuBi
09-04-2001, 07:16 PM
Well now when I delete a topic/thread it leaves the icon user date and time but delete the title. How can I fix this?You can check it out [URL=http://forums.suprascene.com/

handheld234
09-04-2001, 10:48 PM
I don't think you can put just one post in there, delete it and expect it to say nothing. If you look in the first levels those posts are gone, so you are better off posting 4 test posts, deleting the last one, and see if it reverts back to the third post. I don't think you can expect it to say there was never a post now.

LuBi
09-13-2001, 04:06 AM
When I post in a sub-sub forum it does not change the title name on the main forum but when you click the link it take you to the sub of a sub forum. I believe others were having this problem, has this been fixed? If not how can we fix this?

Funkie
09-13-2001, 08:18 PM
Can someone tell me how to fix the icon bug plz

Amasov
09-18-2001, 04:27 PM
I think it depends on the variables.

For example: My Main-Forum has the ID 24. My Subforum has the ID 64. The Script (I don't know why) always referring to Forumid=24.

The Button (laspost.gif) is referring to "lastpost", so that is correct.

But the "$lasttitle" says the specific threadid, which is located in the Mainforum.

Where the hell is the problem? :confused:

Regards,
Chris.

bbqfan
09-20-2001, 07:49 AM
Originally posted by webhost
[B]EXCHANGE[B/]

Can you help with this the subforms are driving me crazy. I read the thread over and over and I see where you mentioned something about this below.

All main forums work great it is just the subforms can you someone pleasehelp me with this?

http://www.vbulletin.com/forum/showthread.php?s=&threadid=28489

bbqfan
09-23-2001, 10:02 AM
yeah!!!
NO. 4...
there are 4 hacks with the same function here... maybe more...

please see my new code:
http://www.vbulletin.com/forum/show...&threadid=28489

maybe it interests you... :)