Announcement

Collapse
No announcement yet.

[RELEASE v2] Last XX Posts on non-vB page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    tubedogg:

    I LOVE this hack.

    I added this to the last10.php file to parse the bbcode in the messages that are displayed.

    First off I added:

    require('./global.php');

    then I changed

    $lastpost2 = $lastpost1[pagetext];

    to

    $lastpost2 = bbcodeparse($lastpost1[pagetext]);

    and

    lastpostshort = $lastpost2;

    to

    $lastpostshort = bbcodeparse($lastpost2);


    This enables the vBcode to parse and show up in the displayed message. HTML (if you allow it) comes through just fine.

    Also, I found if you add the global.php require in the top10.php file you don't need to use the
    require("$path/config.php"); line.

    Thanks again for the great hack.

    Parker

    Comment


    • #17
      *blush*

      Originally posted by Parker Clack
      I LOVE this hack.
      Thanks!

      Originally posted by Parker Clack
      ...then I changed $lastpost2 = $lastpost1[pagetext]; to $lastpost2 = bbcodeparse($lastpost1[pagetext]);
      That's a good idea! However, I wouldn't parse it right there, because then you're parsing it twice if the post is less than $lplen characters. I would parse it within the if()...else() block, because then you are only parsing it once - change
      PHP Code:
          if ($query0 != "" && strlen($lastpost2) > $lplen) {
              
      $lastpostshort substr($lastpost2,0,$lplen);
              
      $lastpostshort .= "...";
          } else {
              
      $lastpostshort $lastpost2;
          } 
      to
      PHP Code:
          if ($query0 != "" && strlen($lastpost2) > $lplen) {
              
      $lastpostshort substr($lastpost2,0,$lplen);
              
      $lastpostshort .= "...";
              
      $lastpostshort bbcodeparse($lastpostshort);
          } else {
              
      $lastpostshort bbcodeparse($lastpost2);
          } 
      Originally posted by Parker Clack
      Also, I found if you add the global.php require in the top10.php file you don't need to use the
      require("$path/config.php"); line.
      Correct, because global.php calls config.php.

      Originally posted by Parker Clack
      Thanks again for the great hack.
      You're welcome! I'll add your bbcodeparsing idea to it and rerelease it pronto - as soon as I finish this other hack I'm working on...
      Last edited by tubedogg; Thu 29 Mar '01, 1:02am.

      Comment


      • #18
        Originally posted by Parker Clack
        tubedogg:

        I LOVE this hack.

        I added this to the last10.php file to parse the bbcode in the messages that are displayed.

        First off I added:

        require('./global.php');

        then I changed

        $lastpost2 = $lastpost1[pagetext];

        to

        $lastpost2 = bbcodeparse($lastpost1[pagetext]);

        and

        lastpostshort = $lastpost2;

        to

        $lastpostshort = bbcodeparse($lastpost2);


        This enables the vBcode to parse and show up in the displayed message. HTML (if you allow it) comes through just fine.

        Also, I found if you add the global.php require in the top10.php file you don't need to use the
        require("$path/config.php"); line.

        Thanks again for the great hack.

        Parker
        Parker,

        I like your additions, but they only work if the person viewing the page has already visited your forum in the past. If they have not they get the dreaded error:

        Warning: Cannot add header information - headers already sent by (output started at /usr/local/etc/httpd/htdocs/sbw/forum/last10.php:2)
        in /usr/local/etc/httpd/htdocs/sbw/forum/admin/functions.php on line 1090

        I like Tube's hack, but until it parses VBCode without the error above for new users I don't think a lot of people will be able to use it.

        Comment


        • #19
          Ah. I did not know that. Scrap that plan. Sorry guys! I won't be adding that to it after all.

          Comment


          • #20
            Hmm... So if they are new members that just signed up on the board or they are just visiting and they aren't registered members they will get this error if they click on the link to this page, or what?

            Parker

            Comment


            • #21
              Originally posted by Parker Clack
              Hmm... So if they are new members that just signed up on the board or they are just visiting and they aren't registered members they will get this error if they click on the link to this page, or what?

              Parker
              When someone visits your forum (Registered members AND guests) they are assigned a cookie.

              Without this cookie your addition to Tubes hack will not work.

              So if you have his hack (with your addition) on your main page, and someone visits there who has never visited your forums they will get the error above. But his hack does work fine "without" your additions for new visitors.

              This is a known problem, and has caused a lot of headaches in most of the "who's online on another page" hacks also.

              Comment


              • #22
                tubedogg:

                Since you are working on hacks how about looking over the memberlist.php file to see if you can add alpha listings instead of just by page number. That is if you click on the letter A you get those members will the last name stating with A and so forth. It can get really tedious when you have over 17,000 registered members to go through page after page by the number of the page.

                Thanks again for the this hack.

                Parker

                Comment


                • #23
                  Originally posted by Sportbikeworld


                  When someone visits your forum (Registered members AND guests) they are assigned a cookie.

                  Without this cookie your addition to Tubes hack will not work.

                  So if you have his hack (with your addition) on your main page, and someone visits there who has never visited your forums they will get the error above. But his hack does work fine "without" your additions for new visitors.

                  This is a known problem, and has caused a lot of headaches in most of the "who's online on another page" hacks also.
                  Thanks for the info. That is odd that it requires a cookie to work right.

                  I just found when using the option to display the message that gets posted and the person has used the vbcode in their message that it will display the code as well.

                  Oh, well. Thanks again for the heads up on this.

                  Parker

                  Comment


                  • #24
                    Robert and tubedogg:

                    I just logged off my board and then manually deleted the cookie I had for the forum from my hard drive and got back on the board. I was not cookied for the forum then and I clicked on the link to take me to the last10.php file. I did not get the cannot add header error message from the database with using the bbparsecode for the message. In fact the page came up just fine as before.

                    Have you tried this on your own board to see if you get the error message?

                    Just thought that I would let you know.

                    Parker
                    Last edited by Parker Clack; Thu 29 Mar '01, 2:16am.

                    Comment


                    • #25
                      Originally posted by Parker Clack
                      Robert and tubedogg:

                      I just logged off my board and then manually deleted the cookie I had for the forum from my hard drive and got back on the board. I was not cookied for the forum then and I clicked on the link to take me to the last10.php file. I did not get the cannot add header error message from the database with using the bbparsecode for the message. In fact the page came up just fine as before.

                      Parker
                      You not only need to delete the cookie to see the error pop-up, but you also need to shut down your browser and restart it. At least that's how I got the error to pop-up with this and other hacks that require global.php

                      Comment


                      • #26
                        Can't select database

                        Can anyone help with a problem I'm having with this script? I keep getting "Can't select database" error every time. All of the variables are set correct, but I still get this. In the last10.php file I see the code:

                        "mysql_select_db($dbname) or die("Can't select database");"

                        This is where the error is at and the script dies there. I havn't changed anything else other than what it said to do. Why is it having troulbe at that line?

                        Thanks for any input.

                        Jeff

                        Comment


                        • #27
                          Try this, Jeff

                          If you're getting that far, then all your variables are indeed set correctly. Can you try something for me? I've attached a zip file to this message - open it, edit the username, password, database host ($dbhost), and database name ($dbname) in both files (testmysql1.php and testmysql2.php) and put both files on your server where the last10.php file is, then go to testmysql1.php in a web browser, e.g. http://www.yoursite.com/path/to/testmysql1.php and tell me what happens.
                          Then go to testmysql2.php e.g. http://www.yoursite.com/path/to/testmysql2.php and tell me what happens.

                          Sorry you're having problems. Hopefully this will solve it!

                          Comment


                          • #28
                            Both test files now say they selected database ok when called from a browser. Now, how to fix in the other to call it ok instead of the error?

                            Jeff

                            Comment


                            • #29
                              congrats!!!
                              It's just maybe too big :/
                              I will modify that

                              Comment


                              • #30
                                Jeff: Hmm. I was expecting those two files to fail. What doesn't make sense is if they worked, why the other one wouldn't. Or, more succinctly, why the other one fails where it does. If it's having problems connecting, it should fail at the connect step, not at the select database step.

                                Here's what I suggest. Since the only thing I'm pulling from the vB files for this is username, password, db host, and database name, put these up at the top of the last10.php file as so:
                                Find
                                Code:
                                // let's get connected
                                require("last10config.php");
                                require("$path/config.php");
                                and replace it with
                                Code:
                                // let's get connected
                                require("last10config.php");
                                $servername = "localhost";
                                $dbusername = "dbusername";
                                $dbpassword = "dbpassword";
                                $dbname = "dbname";
                                and change the info to your details. That should work. If it still doesn't let me know and I'll look into it some more.

                                :scratching head:

                                Comment

                                Related Topics

                                Collapse

                                Working...
                                X