Announcement

Collapse
No announcement yet.

PHP Include

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

  • PHP Include

    I want to include a single file throughout all my forums. How would I go about including just a single file using a PHP include?

  • #2
    You would need to enter the code in a hook that is executed globally.

    global_start might do what you want.

    Comment


    • #3
      I've read over the documentation, but it was still a little confusing to me. Can you point me to any specific examples of how to do this? I read about phpinclude_start and _end, but I couldn't really see how they actually worked and in which template file I needed to use them in or how to call them.

      I'm still a little new to customizing vB.

      Comment


      • #4
        phpinclude_start and end are no longer valid templates in vBulletin 3.5

        you have hooks..

        just enter the php code you wish to use in the hook and it will execute.

        You are already inside of a php enviroment so there is no reason to add <?php and ?>

        Comment


        • #5
          so then ... I would just type something like

          include('/file/path/goes/here');

          and that would include the file?

          Comment


          • #6
            Yes.

            Comment


            • #7
              I attempted that with an echo 'testing1233'; and it failed, it simply just output the text as is. Where am I supposed to be putting this code? I am testing it in the header file because I'm not sure where I should be putting it.

              Comment


              • #8
                Header file? You mean header Template?

                AdminCP > Plugin System > Add New Plugin >

                Select the GLOBAL_START plugin

                Give it a name

                and add your code.

                Comment


                • #9
                  Ah, there we go. I'll try that out, thank you.

                  edit: that worked, beautiful
                  Last edited by jdingman; Thu 29th Sep '05, 6:14am.

                  Comment


                  • #10
                    Hi ,
                    I actually tried that, and went to include a header which i use on all my website pages, but it didnt return a thing.
                    I used to use ob_start in the old head include, now that they are gone, i tried the method here , but didnt return anything !
                    I tried with full php code as in <? ?> and without , anything am missing ?

                    Comment


                    • #11
                      Originally posted by Lebanon
                      Hi ,
                      I actually tried that, and went to include a header which i use on all my website pages, but it didnt return a thing.
                      I used to use ob_start in the old head include, now that they are gone, i tried the method here , but didnt return anything !
                      I tried with full php code as in <? ?> and without , anything am missing ?
                      Something like this?

                      PHP Code:
                      ob_start();
                      include(
                      'file');
                      $variable_name ob_get_contents(); // $variable_name could be anything like $foo or $bar; Just place it in the template where you want the content to appear.
                      ob_end_clean(); 

                      Comment


                      • #12
                        Actually, all I did was go to the Plugin Manager, like Zach suggested, and added a plugin set to global_start and put in the code, as is.

                        ie.
                        echo 'test';

                        and it worked just fine.

                        Comment


                        • #13
                          mine has returned the code UNparsed over the page
                          ie: the header showed : ob_start ......
                          it didnt parse , though i tried with <? and without !
                          so the idea is , it is appearing .. but not parsin the php ...

                          Comment


                          • #14
                            I'm trying to include a php header file in place of the existing logo. I tried all that was listed in this thread but it didn't work. The most I could get it to output was a number "1" and don't ask where that came from cuz I dunno.

                            Comment


                            • #15
                              You can include a file throgh method described above but that file is not processes properly,it will throw a error if you have some other includes in that file.

                              Comment

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