Announcement

Collapse
No announcement yet.

Using vb's header and footer for new php file

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

  • Using vb's header and footer for new php file

    Hi,

    What I want to do is create a new .php file, but using the vb database header and footer.

    I have tried several ways including 'include('$footer');' etc..... but no joy.

    So I want to have a .php file that has the header and footer in and allows me to add a - include("http://www.domain.com/myotherfile.html"); -

    Any help would be very much appreciated.

  • #2
    1. Create new template (for the sake of this example let's call it 'newtemplate'). Add this content:

    Code:
     $headinclude
    <title>Your title</title>
    $header
    Your stuff here
    $footer
    2. Create a new php file (newfile.php) with this content:

    Code:
    <?
    require( "global.php" );
    
    eval("dooutput(\"".gettemplate('newtemplate')."\");");
    
    ?>
    3. Or if you want 'Your stuff here' to be an include, add this to your phpinclude template:

    Code:
    $yourfile = implode("",(file("/path/to/myotherfile.html")));
    Then use $yourfile in the 'newtemplate' template:

    Code:
     $headinclude
    <title>Your title</title>
    $header
    $yourfile
    $footer
    Last edited by Steve Machol; Tue 14 Jan '03, 9:25am.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment


    • #3
      Thats for the help Steve, but I wanted to add an include within the PHP file itself, so rather than me creating loads of templates for new pages, I want to use the 'newtemplate' to just pull the header and footer from and use the php file to pull the information from other html files within my site.

      I can get the information I want in the PHP file using

      Code:
      include("http://www.thepathtotheinfomation.........");
      So when I want to create a new page I create a new php file but just chance the URL in the include like the one above, the problem is I cannot seem to be able to add the header and footer.

      Comment


      • #4
        I use the examples I posted above to do exacly what you want. (See the edited #3.)
        Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
        Change CKEditor Colors to Match Style (for 4.1.4 and above)

        Steve Machol Photography


        Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


        Comment


        • #5
          Jcdr

          Originally posted by Steve Machol
          I use the examples I posted above to do exacly what you want. (See the edited #3.)
          Hi Steve,

          That all works thanks, but I'm going to need to create a few files you see, and don't want to have possibly 100's of custom templates. Is there not a way to just edit the php file to add an include, so when I want to make a new page I don't have to add code to phpinclude, make a new template, and a new php file? Hope you get what I mean.

          Thanks for any help.

          Comment


          • #6
            Sorry, I know of no other ways to do this.
            Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
            Change CKEditor Colors to Match Style (for 4.1.4 and above)

            Steve Machol Photography


            Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


            Comment

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