How do I include php in Widget?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gator777
    Senior Member
    • Feb 2005
    • 159
    • 4.0.0

    [CMS] How do I include php in Widget?

    Any of you smart coders out there can tell me how I can include a .php file in a PHP Direct widget. Any suggestions?

    I tried this, but it does seem to work:

    <?php include("menu.php"); ?>
  • CallieJo
    Senior Member
    • Dec 2004
    • 590
    • 4.0.x

    #2
    If all else fails (no response), you might want to check vbulletin.org for an answer.
    Archive: 1 ~ 2 ETC in the feedback forums that were closed.

    Comment

    • Gator777
      Senior Member
      • Feb 2005
      • 159
      • 4.0.0

      #3
      I got the output to show up, but the output sits on top of the header and does not display in the block. What do I need to get the output to stay in the block?

      Here is my code:

      $output .= include ("http://www.myforum/forum/tsstatus/view.php]"); "<br />\n";

      Comment

      • Lynne
        Former vBulletin Support
        • Oct 2004
        • 26255

        #4
        You may have to rewrite your view.php page so that the output from it goes to the $output variable.

        Please don't PM or VM me for support - I only help out in the threads.
        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
        Want help modifying your vbulletin forum? Head on over to vbulletin.org
        If I post CSS and you don't know where it goes, throw it into the additional.css template.

        W3Schools &lt;- awesome site for html/css help

        Comment

        • steven s
          Senior Member
          • Jul 2004
          • 3722
          • 3.8.x

          #5
          /subscribed.
          I wish to do this too.

          If you find a solution on your own, please post it here.
          ...steven
          www.318ti.org (vB3.8) | www.nccbmwcca.org (vB4.2)
          bmwcca.org/forum | m135i.net
          "I tried to clean this up but this thread is beyond redemption." - Steve Machol

          Comment

          • Gator777
            Senior Member
            • Feb 2005
            • 159
            • 4.0.0

            #6
            I'm very much a novice at this, and I am not quite sure what you are telling me. Could you elaborate a little for me?

            Here is a link to the event as described above:
            Link Removed
            As you can see, the widget displays the item at the top of the page, and paces a "1" in the content part of the block
            Last edited by Gator777; Tue 29 Dec '09, 11:04pm. Reason: Link Removed

            Comment

            • Lynne
              Former vBulletin Support
              • Oct 2004
              • 26255

              #7
              I can't explain it any better. You wrote a script, view.php, and I think you need to rewrite it so the output from that script goes to $output. Doing a return or echo doesn't work in that widget.

              Please don't PM or VM me for support - I only help out in the threads.
              vBulletin Manual & vBulletin 4.0 Code Documentation (API)
              Want help modifying your vbulletin forum? Head on over to vbulletin.org
              If I post CSS and you don't know where it goes, throw it into the additional.css template.

              W3Schools &lt;- awesome site for html/css help

              Comment

              • Gator777
                Senior Member
                • Feb 2005
                • 159
                • 4.0.0

                #8
                I did not write the script, but thanks anyway! Maybe Brian over at vBAdvanced.com will release a new CMPS, so I can more easily add it to my site. The CMS would have been a good idea, but it's not user-friendly to the average user. I am really dissatisfied with vBulletin 4.0 at this point, and I am starting to regret having purchased it.
                Last edited by Gator777; Tue 29 Dec '09, 11:06pm.

                Comment

                • Gator777
                  Senior Member
                  • Feb 2005
                  • 159
                  • 4.0.0

                  #9
                  For those who might have been following this post, the VB Customer Support department assisted me with this issue, and the fix is...

                  PHP Code:
                  // UNTESTED
                  ob_start();
                  include(
                  "path/to/your.php");
                  echo 
                  "<br />\n";
                  $output .= ob_get_contents();
                  ob_end_clean(); 
                  I actually removed the line containing "echo" to prevent the break at the bottom.

                  If this help you, please respond in this post and let the VB team know.

                  Comment

                  • steven s
                    Senior Member
                    • Jul 2004
                    • 3722
                    • 3.8.x

                    #10
                    Originally posted by Gator777
                    For those who might have been following this post, the VB Customer Support department assisted me with this issue, and the fix is...
                    This is going to help tremendously!
                    Thanks.
                    ...steven
                    www.318ti.org (vB3.8) | www.nccbmwcca.org (vB4.2)
                    bmwcca.org/forum | m135i.net
                    "I tried to clean this up but this thread is beyond redemption." - Steve Machol

                    Comment

                    • lifanovsky
                      Senior Member
                      • Oct 2004
                      • 269
                      • 4.0.0

                      #11
                      Yes. Now it works as intented. Who its not enough just to put raw php in the wdiget code...
                      Boris Lifanovsky; administrator of the biggest Russian classical music forum

                      Lifanovsky.com | ForumKlassika.Ru

                      Comment

                      • pyd
                        Senior Member
                        • Feb 2005
                        • 122
                        • 3.8.x

                        #12
                        worked like a charm!

                        Comment

                        • ZoDesigns.com
                          Senior Member
                          • Nov 2005
                          • 272
                          • 3.5.x

                          #13
                          Hmm... I tried a simple

                          PHP Code:
                          <?php
                                
                          echo "hello world!";
                          ?>
                          and nothing was outputted.

                          Comment

                          • Lynne
                            Former vBulletin Support
                            • Oct 2004
                            • 26255

                            #14
                            Originally posted by ZoDesigns.com
                            Hmm... I tried a simple

                            PHP Code:
                            <?php
                                  
                            echo "hello world!";
                            ?>
                            and nothing was outputted.
                            Originally posted by Lynne
                            I can't explain it any better. You wrote a script, view.php, and I think you need to rewrite it so the output from that script goes to $output. Doing a return or echo doesn't work in that widget.
                            Try

                            PHP Code:
                                  $output"hello world!"

                            Please don't PM or VM me for support - I only help out in the threads.
                            vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                            Want help modifying your vbulletin forum? Head on over to vbulletin.org
                            If I post CSS and you don't know where it goes, throw it into the additional.css template.

                            W3Schools &lt;- awesome site for html/css help

                            Comment

                            • ZoDesigns.com
                              Senior Member
                              • Nov 2005
                              • 272
                              • 3.5.x

                              #15
                              thanks. What would I do with this code to get it to output (I am a designer, not a developer)?


                              PHP Code:
                              <?php
                                                      $nameOfSlideshowToDisplay 
                              "myslideshow"
                                                      
                              $URLofyoursite "http://www.xxxxxxxx.com";   
                                                      
                              $AbsoluteServerPathofyoursite "/home/xxxxx/domains/xxxxx.com/public_html"
                                                      include_once(
                              $AbsoluteServerPathofyoursite."/fpss/mod_fpslideshow.php");

                              ?>

                              Comment

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