Announcement

Collapse
No announcement yet.

How do I include php in Widget?

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

  • Mondy
    replied
    Steven - u r *

    Thanks millions man - c result here: http://gblcg.com

    if i'd like to put a bit of space between the bottom of the widget and the beginning of the main contents section should I look at changing a style_var here? I'll be taking a look right now..

    Originally posted by steven s View Post
    What I would is create your slide show as a standalone file on your server to ensure that it works.

    public_html/path/mod_fpslideshow.php

    Then use

    PHP Code:
    ob_start();
    include(
    "/home/pathto/mod_fpslideshow.php");
    echo 
    "<br />\n"/* optional space */
    $output .= ob_get_contents();
    ob_end_clean(); 

    Leave a comment:


  • steven s
    replied
    What I would is create your slide show as a standalone file on your server to ensure that it works.

    public_html/path/mod_fpslideshow.php

    Then use

    PHP Code:
    ob_start();
    include(
    "/home/pathto/mod_fpslideshow.php");
    echo 
    "<br />\n"/* optional space */
    $output .= ob_get_contents();
    ob_end_clean(); 

    Leave a comment:


  • Mondy
    replied
    Gents - this is precisely the thread I was looking for!!

    The code at hand is for FrontPage Slide Show, which I am trying to move into a widget as illustrated in the attachment.

    I've tinkered with this for a few hours now but - me too - cannot make it work.

    see site now: http://gblcg.com

    What code must I use in what widget to make it all better?

    PS: just as a refresh, this is the out-of-box code:

    <?php
    // START of "Frontpage Slideshow" settings
    $nameOfSlideshowToDisplay = "myslideshow"; // Enter the name of your slideshow. Slideshows are in folders inside /fpss/slideshows/.
    $URLofyoursite = "http://www.mysite.com"; // Enter your site's URL.
    $AbsoluteServerPathofyoursite = "/home/user/public_html"; // Enter the root path of your site on the server.

    // do not edit below this line
    include_once($AbsoluteServerPathofyoursite."/fpss/mod_fpslideshow.php");
    // END of "Frontpage Slideshow" settings
    ?>
    Thanks all!
    Attached Files

    Leave a comment:


  • steven s
    replied
    Originally posted by edshuck View Post
    My apologies to the thread and to the vB family.

    stephen s helped me through the problem - some of that was off line. But all is good now. I have become an instant "old hand" at widgets.
    Thanks, but that is steven

    Leave a comment:


  • edshuck
    replied
    My apologies to the thread and to the vB family.

    stephen s helped me through the problem - some of that was off line. But all is good now. I have become an instant "old hand" at widgets.

    Leave a comment:


  • ZippySLC
    replied
    Many thanks for this thread!

    Leave a comment:


  • ZoDesigns.com
    replied
    Problem solved. It helps if the widget was created with "PHP Direct Execution"...

    Leave a comment:


  • ZoDesigns.com
    replied
    Originally posted by steven s View Post
    Does you script work outside of vB?
    That is, can you run it directly from the file?
    Yes, it does work outside of vb. It's currently running on SirStevesGuide.com.

    Leave a comment:


  • steven s
    replied
    Originally posted by edshuck View Post
    I think I may have a handle on the problem - not the solution.
    PM sent

    Edit: I don't think you can run php within an article.
    You need to make it a widget.

    Leave a comment:


  • edshuck
    replied
    I think I may have a handle on the problem - not the solution.

    I have a piece of code that works really well outside templates. The ob_start(), and its two cousin functions are needed for operation inside templates. They will also do things outside templates, but are needed within the vB widget serving php.

    Will you do this, steven s, tell us 1) when you build the widget - the detaisls, what goes in what box. 2) where do you put it or even is it moved, how. 3) How do you call the widget into the article?

    My page is a bit ugly but go over to it and click shopping and the entire right hand side of the page is generated on the fly. The code works but not in the template and obviously since you and others can use the templates with effectiveness, the coders at vB have done their job right. I just do not know how to make use of this.

    Thanks for all the help you have already been.

    peace

    ed
    www.noevalley.com

    Leave a comment:


  • steven s
    replied
    Originally posted by ZoDesigns.com View Post
    No luck... it just displays the code and does not render it.
    Does you script work outside of vB?
    That is, can you run it directly from the file?

    Leave a comment:


  • ZoDesigns.com
    replied
    No luck... it just displays the code and does not render it.

    Leave a comment:


  • steven s
    replied
    First of all, don't wrap <?php around your code.
    Originally posted by ZoDesigns.com View Post
    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");

    ?>

    Leave a comment:


  • edshuck
    replied
    I will try this in the am. I will have a primary loop running with a secondary operating within it. If it can handle that, I am good to go on this problem.

    Leave a comment:


  • ZoDesigns.com
    replied
    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");

    ?>

    Leave a comment:

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