No announcement yet.

PHP Page

  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP Page

    How can I create a PHP page that will use my headers and footer?

    I want to create a few more pages with some other information on them, but I want these pages to use the same header and footer as my forums.
    I want to be able to store this new information in templates and have them called up as well.

    Could someone send me a PHP page I could use that will display my header.

    Allow me to call up a template with all my html tables and stuff in it.

    And display my footer.

    Sorry if this is not very clear

    Thanks in advance


  • #2
    I just use the vBulletin template system to hold any page that I want to use other templates. This gives the added benefit of being editable from anywhere without the use of FTP like when I am at my parent's house.

    Then I create a file that will call the template. It is simple really.

    Here is one for our chat page.
    eval("echo dovars(\"".gettemplate("chat")."\");");
    Just put the proper template name in the gettemplate function.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API - Full / Mobile
    Vote for your favorite feature requests and the bugs you want to see fixed.


    • #3
      simple as that hey
      thanks, I thaught it would be a bit harder than that....

      ::feels stupid::


      • #4
        k.. next question.

        Now I have my one page, how do I get it to go to different sections...

        like if you go to
        it would take to to a template called scotland

        but if you went to
        it would take to to a template called england

        Thanks in advance



        • #5
          Just do something along these lines. For each action, have an if statement that will execute the appropriate code.

          if ($action == "scotland") {
            // Code used if action=scotland
            // Use Template Scotland
            eval("echo dovars(\"".gettemplate("scotland")."\");");
          if ($action == "england") {
            // Code used if action=england
            // Use Template England
            eval("echo dovars(\"".gettemplate("england")."\");");
          Also, after getting that to work, you may want add more to it to return an error if an invalid action is set, or set a default action to take if none is given at all.


          • #6
            Here, this'll be easier to maintain:

            // Add any templates to the array (in the same format) that you want to allow
            $allowed = array(
              "england" => "yes",
              "scotland" => "yes"
            if ( !isset($allowed["$action"]) ) {
               echo "Invalid action specified";
            eval("echo dovars(\"".gettemplate("$action")."\");");


            • #7
              Ed, the trouble is I won't actually be using the same names for the templates.

              Ben that kinda works..... but how do I set it to load a template when no action is set.
              ie when they just go to /map.php


              • #8
                Just use ed's code and change the names.


                • #9
                  Just change the array part:

                  "england" => "yes",
                  // In the format:
                  // "template name" => "yes"
                  // Remember the comma if it's not the last part

                  And if an invalid action is set, in mine just the echo "Invalid..."; line to:

                  $action = "default template name";