parsing posts outside of vbulletin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sde
    Member
    • May 2002
    • 47

    parsing posts outside of vbulletin

    summary: how can i parse the post text like vbulletin does outside of the forums?

    we have a programming community that has grown over the last year. we allow our users to post tutorials and recently integrated the tutorials into vbulletin to make it easier for users to create them.

    i only want users to submit tutorials in the forums .. and i am coding a 'tutorial viewer' from scratch. i need the tutorials section of the site to be its own and have its own look. also, i don't want the forums pruning the tutorials.

    with my tutorial viewer, it is just retrieving data from the vbulletin db where there is a common parentid.

    the problem i am running up against is the ability to parse the posts like vb does. the authors are creating the tutorials in vb with all the features such as and [c olor=somecolor] .

    so here is my question: i see the bbcodeparse() function in the functions.php, .. and first off i'd like to know if it is ok to use that to further integrate my site into vbulletin?

    wether or not it is ok, i admit i've tried with no luck.

    secondly, if it is ok, can someone give me a hint how i can parse it?

    $post=bbcodeparse($post) does not seem to do much. it probably has something to do with the db connection and i'm trying to run the function outside of the /forum directory.

    if anyone can help or give me suggestions, i would greatly appreciate it. if i'm breaking rules here, let me know.

    thanks
  • fury
    Senior Member
    • Jun 2001
    • 1464

    #2
    The bbcodeparse functions rely on a connection to the database which global.php initializes, which also calls functions.php which contains the bbcodeparse functions. So, including global.php might help

    Comment

    • sde
      Member
      • May 2002
      • 47

      #3
      Originally posted by fury
      The bbcodeparse functions rely on a connection to the database which global.php initializes, which also calls functions.php which contains the bbcodeparse functions. So, including global.php might help
      thankyou, .. i thought i tried that, but i will try again.

      in theory, should it work below the /forum directory? that is where i was trying to include it before, but i will try again.

      i really appreciate the insight.

      thanks

      Comment

      • Icheb
        Senior Member
        • Nov 2002
        • 1291

        #4
        It will work correctly if you use the correct path-definitions in your include().

        Comment

        • sde
          Member
          • May 2002
          • 47

          #5
          Originally posted by Icheb
          It will work correctly if you use the correct path-definitions in your include().
          thanks guys.. it is getting close but not quite working. it seems to do the nl2br() function because my new lines are showing .. however the [co de] and [ph p] tags are not working.

          my include paths are correct .. here is a sample of the way i'm using it:
          PHP Code:
          <?
          include("forum/globals.php");
          include(
          "forum/admin/functions.php");
           
          $text="[code]some code here[/code]";
           
          echo 
          bbcodeparse($text);
          ?>
          here's an example of the output. it seems to be somewhat working, but none of the vb tags are parsing.



          any ideas?

          Comment

          • fury
            Senior Member
            • Jun 2001
            • 1464

            #6
            forum/global.php already includes admin/functions.php by default, no need to include it twice.

            Also, I believe the setting for vB Code in signatures needs to be on (set to "yes") in your board for bbcodeparse to work outside of a thread.
            Last edited by fury; Tue 4 Mar '03, 12:08pm.

            Comment

            • sde
              Member
              • May 2002
              • 47

              #7
              Originally posted by fury
              forum/global.php already includes admin/functions.php by default, no need to include it twice.

              Also, I believe the setting for vB Code in signatures needs to be on (set to "yes" ) in your board for bbcodeparse to work outside of a thread.
              thanks a lot fury.. i finally got it working but only inside the /forum directory. i think that is because include() is a reletive path and when it includes the functions.php , the path is not shown.

              my web server isn't shoiwing the warnings.. so i can only assume that is the problem. next i will try to copy the global file because i'd really prefer to keep this out of the forum directory.

              thanks a lot! i really do apprecaite the help!

              Comment

              • fury
                Senior Member
                • Jun 2001
                • 1464

                #8
                NP

                BTW, You could try a chdir("forums/"); first and then run the include as just include("global.php");

                Comment

                • sde
                  Member
                  • May 2002
                  • 47

                  #9
                  Originally posted by fury
                  NP

                  BTW, You could try a chdir("forums/" ); first and then run the include as just include("global.php" );
                  that is genius =) thanks, .. i learn something new everyday! works perfect.

                  Comment

                  • TeKnIcIaN
                    Member
                    • Feb 2003
                    • 53

                    #10
                    The function bbcodeparse($bbcode,$forumid=0,$allowsmilie=1) checks the forum for permissions on whether or not to use bbcode, imgcode or HTML. If you don't give it a forumid, then I think all permissions are set to off (and it won't parse anything beyond nl2br stuff)

                    You should use function bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode) and pass it the parameters of what you want it to do
                    PHP Code:
                    $text "This works [b.]really[/b.] well for me";
                    print 
                    bbcodeparse2($text0111);

                    // bbcode and smilies butchered out of this example
                    // coz they won't show up here properly 

                    Comment

                    • fury
                      Senior Member
                      • Jun 2001
                      • 1464

                      #11
                      If bbcodeparse isn't given a forumid, it takes from the settings given in the vBulletin admin control panel.

                      Comment

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