Announcement

Collapse
No announcement yet.

Using phpInclude

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

  • Using phpInclude

    This code goes in my phpInclude:
    PHP Code:
    include($_SERVER['DOCUMENT_ROOT']."/clsBanner.php");
    $banner = new banners(); 
    How do I get this code to work in a template?
    PHP Code:
    $banner->largeBanner(); 
    I tried putting this in the header so I could use $bannerCode in the template, but it displayed the banner at the top, not where I wanted:
    PHP Code:
    $bannerCode $banner->largeBanner(); 

  • #2
    Either try using
    $banner->largeBanner();
    where you want the banner to display... or...

    $bannerCode = $banner->largeBanner();
    where you want the banner to display

    Comment


    • #3
      The first gives me (): while the second gives me =(); - neither work because the code is stripped. Thanks for trying though, have any other ideas? This is frustrating.

      Comment


      • #4
        Are you putting $bannerCode = $banner->largeBanner(); in the header template or the phpinclude template?
        --filburt1, vBulletin.org/vBulletinTemplates.com moderator
        Web Design Forums.net: vB Board of the Month
        vBulletin Mail System (vBMS): webmail for your forum users

        Comment


        • #5
          I put it in the phpInclude template so then I could put $banner in the header template, but that just processes the code at the very top of the page instead of where I put $banner. I can't put that line in any other template because it's PHP and that doesn't work.

          Comment


          • #6
            I'm confused; is this what you're doing:

            in phpinclude:
            PHP Code:
            include($_SERVER['DOCUMENT_ROOT']."/clsBanner.php");
            $banner = new banners();
            $bannerCode $banner->largeBanner(); 
            in header:
            Code:
            $bannerCode
            ?
            --filburt1, vBulletin.org/vBulletinTemplates.com moderator
            Web Design Forums.net: vB Board of the Month
            vBulletin Mail System (vBMS): webmail for your forum users

            Comment


            • #7
              Correct. What that does is place the processed PHP code at the very top of the html file, not in the header where I want it.

              Comment


              • #8
                phpinclude:
                PHP Code:
                include($_SERVER['DOCUMENT_ROOT'].'/clsBanner.php');
                $banner = new banners();
                ob_start();
                $banner->largeBanner();
                $bannerCode ob_get_contents();
                ob_end_clean(); 
                header:
                Code:
                $bannedCode
                Chen Avinadav
                Better to remain silent and be thought a fool than to speak out and remove all doubt.

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

                Comment


                • #9
                  Thank you thank you thank you! I'm fairly clueless when it comes to these things.

                  Comment


                  • #10
                    Very ineffiencent!

                    You should integrate the code properly!
                    Raz - KMC Forums

                    Comment

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