[RELEASE 1.0 beta] LAST THREAD NAME

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • somnium
    New Member
    • Jul 2001
    • 8

    [RELEASE 1.0 beta] LAST THREAD NAME

    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:
    PHP Code:
            // prepare template vars
            
    if (!$showforumdescription) {
              
    $forum['description']='';
            } 
    below that add:
    PHP Code:
           $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:
    PHP Code:
    <a href="member.php3?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a
    und this add:
    PHP Code:
    <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
    Senior Member
    • Mar 2001
    • 151

    #2
    Very very cool!
    You have done a difficult thing so easy.
    congratulations!

    Comment

    • Maverick1236
      Senior Member
      • Apr 2001
      • 346

      #3
      last Post title

      any way I can show the last post title under the last thread title??
      TIA!!

      Comment

      • ztsky
        Senior Member
        • Mar 2001
        • 151

        #4
        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

        Comment

        • somnium
          New Member
          • Jul 2001
          • 8

          #5
          hhmm

          i didn't test it with subforums.

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

          Comment

          • ztsky
            Senior Member
            • Mar 2001
            • 151

            #6
            Re: hhmm

            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.

            Comment

            • somnium
              New Member
              • Jul 2001
              • 8

              #7
              hmm

              i don't know how to debug but i think there must be an answer!!

              you can hack everythin you want!!!

              Comment

              • EXCHANGE
                Senior Member
                • Feb 2001
                • 129

                #8
                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.

                PHP Code:
                //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 

                Comment

                • somnium
                  New Member
                  • Jul 2001
                  • 8

                  #9
                  cool

                  many thx for that!!!

                  Comment

                  • EXCHANGE
                    Senior Member
                    • Feb 2001
                    • 129

                    #10
                    Another thing.
                    There is a Problem when moving a thread and leave a link in another forum.
                    So here is another fix:
                    PHP Code:
                            //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:

                    Code:
                    <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>
                    Last edited by EXCHANGE; Sun 29 Jul '01, 4:44am.

                    Comment

                    • adrianmak
                      Member
                      • Dec 2000
                      • 65

                      #11
                      Cool !

                      May i get a final hack ?

                      Thanks

                      Comment

                      • EXCHANGE
                        Senior Member
                        • Feb 2001
                        • 129

                        #12
                        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
                        PHP Code:
                        // prepare template vars
                                
                        if (!$showforumdescription) {
                                  
                        $forum['description']='';
                                } 
                        With the second Part of Code replace the template forumhome_lastpostby.

                        Comment

                        • Fryzid
                          Senior Member
                          • Jun 2000
                          • 164

                          #13
                          Little addition

                          In EXCHANGEs code add
                          PHP Code:
                          $fulltitle $lastposttitle
                          after
                          PHP Code:
                          $lastposttitle $lastposttitle[title]; 
                          and then change the threadname link to
                          Code:
                          <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]" [color=red]title="$fulltitle"[/color]><b>$lastposttitle</b></a>
                          Then you have the full title in a popup box.

                          Comment

                          • Mark Hewitt
                            Senior Member
                            • Apr 2000
                            • 1195
                            • 4.1.x

                            #14
                            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?
                            Motorsport Forums

                            Comment

                            • handheld234
                              Member
                              • Jul 2001
                              • 44

                              #15
                              Works for me!

                              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!

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...