Announcement

Collapse
No announcement yet.

How do I include php in Widget?

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

  • [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"); ?>

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


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


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


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


          • #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; Wed 30th Dec '09, 12:04am. Reason: Link Removed

            Comment


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


              • #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; Wed 30th Dec '09, 12:06am.

                Comment


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


                  • #10
                    Originally posted by Gator777 View Post
                    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


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


                      • #12
                        worked like a charm!

                        Comment


                        • #13
                          Hmm... I tried a simple

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

                          Comment


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

                            PHP Code:
                            <?php
                                  
                            echo "hello world!";
                            ?>
                            and nothing was outputted.
                            Originally posted by Lynne View Post
                            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


                            • #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...
                              X