Announcement

Collapse
No announcement yet.

How do I include php in Widget?

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

  • Lynne
    replied
    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!"

    Leave a comment:


  • ZoDesigns.com
    replied
    Hmm... I tried a simple

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

    Leave a comment:


  • pyd
    replied
    worked like a charm!

    Leave a comment:


  • lifanovsky
    replied
    Yes. Now it works as intented. Who its not enough just to put raw php in the wdiget code...

    Leave a comment:


  • steven s
    replied
    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.

    Leave a comment:


  • Gator777
    replied
    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.

    Leave a comment:


  • Gator777
    replied
    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.

    Leave a comment:


  • Lynne
    replied
    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.

    Leave a comment:


  • Gator777
    replied
    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

    Leave a comment:


  • steven s
    replied
    /subscribed.
    I wish to do this too.

    If you find a solution on your own, please post it here.

    Leave a comment:


  • Lynne
    replied
    You may have to rewrite your view.php page so that the output from it goes to the $output variable.

    Leave a comment:


  • Gator777
    replied
    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";

    Leave a comment:


  • CallieJo
    replied
    If all else fails (no response), you might want to check vbulletin.org for an answer.

    Leave a comment:


  • Gator777
    started a topic [CMS] How do I include php in Widget?

    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"); ?>
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X