Announcement

Collapse
No announcement yet.

put an "include" call in template file ?

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

  • put an "include" call in template file ?

    Hi have been trying to get a banner program to insert a rotating banner into my header template but if I put in the folloing code all that happens is it gets printed on the sreen.

    include("/home/sites/site77/web/banner/ad/ad.php");

    Any help would be appreciated as currently I am using a framed page to display banners and that does not work for links to threads called from other sites.

    Thanks in advance for ANY help you can offer.

    GT

  • #2
    Code:
    $myad = implode('',file('/home/sites/site77/web/banner/ad/ad.php'));
    Put that in your phpinclude template and then reference $myad where you want it.

    Comment


    • #3
      Am I doing something wrong?

      I have edit the phpinclude template and it now looks like:

      // This code is PHP4 ony:
      // ob_start();
      // require("yourheader.html");
      // $header = ob_get_contents();
      // ob_end_clean();
      $myad = implode ('',file '/home/sites/site77/web/banner/ad/ad.php'));

      Then to test it I changed the footer template to:

      </td>
      </tr>
      </table>
      <!-- /content area table -->
      </center>

      <p align="center">
      <normalfont><b>&lt; <a href="$contactuslink">Contact Us</a> - <a href="$homeurl">$hometitle</a> - <a href="/links.shtml">Links</a> - <a href="/policy.shtml" target="_parent">Usage Policy</a> &gt;</b></normalfont>
      </p>
      <p align="center">
      $myad
      </p>
      <p align="center"><smallfont>
      <!-- Do not remove this copyright notice -->
      Powered by: vBulletin Version $templateversion<br>
      Copyright &copy;2000, 2001, Jelsoft Enterprises Limited.<br>
      <!-- Do not remove this copyright notice -->
      $copyrighttext
      </smallfont></p>


      However all that happens on the screen is I get pages and pages of the code in the ad.php file displayed.

      Again any thoughts greatly appreciated.

      GT

      Comment


      • #4
        That's odd...try
        Code:
        $myad = implode('', file("/home/sites/site77/web/banner/ad/ad.php"));

        Comment


        • #5
          No again

          It just displayed all the code from the file we are trying to include again.

          But thanks again for the effort.

          Should I perhaps use a Java Script instead ?

          GT

          Comment


          • #6
            Tubedogg -- if you want to use that way, you have to use the URL to the file.

            GT -- Try:

            $myad = implode('', file("http://www.domain.com/banner/ad/ad.php"));

            (changing the URL to suit)

            Comment


            • #7
              That one works, Thanks Guys

              THANK YOU

              Comment


              • #8
                use it,my page very slow
                why?

                Comment


                • #9
                  Originally posted by xixi
                  use it,my page very slow
                  why?
                  May because the banner takes long to load...
                  Ueli

                  Comment


                  • #10
                    no
                    because
                    PHP Code:
                    $news implode("\n",file("$bburl/news.php")); 
                    use:
                    ob_start();
                    require("news.php");
                    $news= ob_get_contents();
                    ob_end_clean();

                    very fast

                    why?

                    Comment


                    • #11
                      Hi

                      I have a similar problem.

                      I'd need to have this somehow integrated to all pages:

                      require '/dir/public_html/sympoll/booth.php';

                      when using implode in phpinclude template im getting the content of that file spammed accross the screen.

                      It's necessary to have it with a path not the url to that file (dunno why but thats what it says in the instructions)

                      Any help would be greatly appreciated

                      -Alex
                      I want to express my deepest compassion to all who have lost their loved ones in the latest terroristic attack

                      >> Nuke Bin Laden yourself here <<

                      Webmaster NÐE | Webmaster UA Forums | ArtworX ECL | Admin DiGL | Hosted at RWH | Portfolio

                      My Stylez
                      Red Darkness | Velvet Night | Dreadful Cyan
                      Goodiez
                      Table bgcolor change on hover | Onlinestatus modifications | German Templates

                                                     \\\ ///
                                                      (ô ô)
                      -------------------ooO-(_)-Ooo-----------------

                      Comment


                      • #12
                        I add that code, but i get this at the bottom of all of my pages..

                        implode('', file("banners_eng.inc"));
                        Ken Prescott - 21Studios freelancing design
                        Graphic-Forums - The Forums for the Graphic User

                        Comment


                        • #13
                          You said in another thread you added it to your footer template.
                          That is a wrong thing to do.
                          You need to add it to your phpinclude template, and then use $myad in your footer template.
                          Chen Avinadav
                          Better to remain silent and be thought a fool than to speak out and remove all doubt.

                          גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                          Comment


                          • #14
                            Firefly, I am braindead when it comes to this. How, and what do I add to the PHP Include, and then what do I add to my footer, my phpinclude looks like this currently:

                            // This code is PHP4 only:
                            // ob_start();
                            // require("yourheader.html");
                            // $header = ob_get_contents();
                            // ob_end_clean();


                            Sorry If this question is too obvious.
                            Ken Prescott - 21Studios freelancing design
                            Graphic-Forums - The Forums for the Graphic User

                            Comment


                            • #15
                              phpinclude:
                              PHP Code:
                              // This code is PHP4 only: 
                              // ob_start(); 
                              // require("yourheader.html"); 
                              // $header = ob_get_contents(); 
                              // ob_end_clean(); 
                              $myad implode(''file("http://www.domain.com/banner/ad/ad.php")); 
                              (change path)

                              And add $myad to any of your templates.
                              Chen Avinadav
                              Better to remain silent and be thought a fool than to speak out and remove all doubt.

                              גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                              Comment

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