Announcement

Collapse
No announcement yet.

How to place contents of HTML file in template?

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

  • How to place contents of HTML file in template?

    Is there a way to include an HTML file in a template? In otherwords, I make frequent updates to one of my pages. I'd like to create a template that uses the vB headinclude, header and footer templates, and put the contents of the HTML file in between the header and footer sections.

    Can that be done, and if so, how?
    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.



  • #2
    There's no way of doing this just using vBulletin; you will need a bit of code hacking. Take a look at misc.php for more info.

    John
    John Percival

    Artificial intelligence usually beats real stupidity ;)

    Comment


    • #3
      Darn! Thanks John.
      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


      • #4
        Just create the template and then create a php page for it like so:
        PHP Code:
        <?php

        $templatesused
        ='index'// not needed for only one template
        chdir('/home2/juan/www/forums');
        include(
        '/home2/juan/www/forums/global.php');

        eval(
        "dooutput(\"".gettemplate('index')."\");");

        ?>
        That is a real example of one of my pages. Since it is in a different directory than the forums code I need to use the chdir so that php doesn't complain about not being able to find files.

        Comment


        • #5
          Thanks Freddie! I'll give this a try.
          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


          • #6
            I tried this, but it didn't work. I guess I'm confused on how to use it. What I want is to keep an HTML file on my server and have the template call that file. I can see how this calls the template, but what needs to go into the template in order to bring up the contents of the HTML file?
            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


            • #7
              *bump*
              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


              • #8
                OK - I've only had vB a few days, but I'm sort of getting the hang of styles and the best way to make use of phpinclude.

                I worked this out, which I think should work - you can also use a switch() to alter the file you want to include by relating to the $styleid.

                $MyHtml = implode("",(file("path/to/file.html")));

                Then just drop $MyHtml in the template where you need it.
                Last edited by chilliboy; Fri 22 Jun '01, 9:19am.

                Comment


                • #9
                  Thanks! I'll give this a try.
                  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


                  • #10
                    Chilliboy, you are a bloomin' genius! It works perfectly!

                    Thanks a bunch.
                    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


                    • #11
                      Wow. Nice.

                      Comment


                      • #12
                        Hi Chilliboy

                        Im very new to this and this is exactly what I need to do.
                        Please could you explain in a bit more detail for me.

                        $MyHtml = implode("",(file("path/to/file.html"))); Where do you put this??

                        Then just drop $MyHtml in the template where you need it. This I think I understand.

                        Thank You
                        Mark

                        Comment


                        • #13
                          martrt,

                          That goes in the phpinclude template. Works great!
                          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


                          • #14
                            WOW, I'm really not sure what you guys are talking about, or what it does, but it does sound cool.

                            Can you give a better explanation of where to put the code and maybe a link to a demo of how this works?

                            And even better yet maybe an official hack release with full detailed instructions on how to install it.

                            I don't mean to sound totally ignorant, but sometimes you senior members go way over my head.

                            Comment


                            • #15
                              Hi

                              Thanks for the help I have managed to get the html page to load in the forum, but it comes without any colour?
                              The page I am importing is http://www.carponline.com/Directory/Manufactures2.htm

                              I am working on a menu for the top of the forum (when I get the links to all the buttons right then I will paste it it to the header. The button I am working on is "Tackle Shop Directory / Tackle Manufactures. This menu is at http://www.carponline.com/Forum/menus_test.htm Why does this come as black and white?

                              Thank You
                              Mark

                              Comment

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