Announcement

Collapse
No announcement yet.

How do I include php in Widget?

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

  • #16
    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.
    Ed Shuck
    noevalley.com

    Comment


    • #17
      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");

      ?>
      ...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


      • #18
        No luck... it just displays the code and does not render it.

        Comment


        • #19
          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?
          ...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


          • #20
            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
            Ed Shuck
            noevalley.com

            Comment


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


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

                Comment


                • #23
                  Problem solved. It helps if the widget was created with "PHP Direct Execution"...

                  Comment


                  • #24
                    Many thanks for this thread!

                    Comment


                    • #25
                      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.
                      Ed Shuck
                      noevalley.com

                      Comment


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


                        • #27
                          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
                          http://gblcg.com - The Business of Your Future - Strategy Redefined.

                          Comment


                          • #28
                            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(); 
                            ...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


                            • #29
                              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(); 
                              http://gblcg.com - The Business of Your Future - Strategy Redefined.

                              Comment


                              • #30
                                This thread was very helpful in my setup of Frontpage Slideshow. Thanks!

                                Comment

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