Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: My Layout HELP!

  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    My Layout HELP!

    Im new at this php thing so sorry if this is a stupid question. Is there a way to change the layout on all the web pages without going to every single one to change it

  • #2
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Um.... well... I am asuming the site you are referring to is already made? If it is already made then no, but if it isn't then yes and it is really easy.

    Simply make all your pages .php. Make your index page... then what you do is divide your page into 3 different parts... the part above the actual page content, the part below the page content, and the actual page content. Then what you do is you make a top.php, bottom.php, and whatever.php.

    And in the top you but what is above your content in the layout, in the bottom you but what is below the content, and in the whatever you put....

    Code:
    <?php include('top.php');?>
    Page Content Goes Here
    <?php include('bottom.php');?>
    So what our page will actually turn out like in our visitors browsers will be like this.....

    Code:
    <!-- Contents Of Top.php -->
    <html>
    <head>
    <title></title>
    </head>
    <body>
    
    <!-- Your Pages Main Content -->
    Page Content Goes Here
    
    <!-- Contents Of Bottom.php -->
    </body>
    </html>
    Make sense? Lemme know if you dont get it...
    Last edited by Troy297; 01-07-2007 at 09:22 PM.
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #3
    New Coder
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    but how would i know that the content would be where i want it to be and how would i divide the content up???

  • #4
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Sorry about that... I edited the last post - please re-read it!
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #5
    New Coder
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im sorry but im new at this whole php thing if you could look at my other post and try to help me??? much thanks i kinda get it in a way

  • #6
    Regular Coder Troy297's Avatar
    Join Date
    Oct 2006
    Location
    Earth
    Posts
    314
    Thanks
    10
    Thanked 0 Times in 0 Posts
    What other post do you mean? A link would be helpful! But to try and recap what I said more simply....

    1. Design Your Page
    Code:
    <html>
    <head>
    <title>My PHP Website</title>
    </head>
    <body>
    <div class="main">
    This is my main content and other stuff....
    </div>
    </body>
    </html>
    2. Divide Up Your Code
    Make A New File Called Top.php With The Following In It
    Code:
    <html>
    <head>
    <title>My PHP Website</title>
    </head>
    <body>
    <div class="main">
    Page Content
    Code:
    This is my main content and other stuff....
    Make A New File Called Bottom.php With The Following In It
    Code:
    </div>
    </body>
    </html>
    3. Create Your Php Page
    Code:
    <?php include('top.php');?>
    This is my main content and other stuff....
    <?php include('bottom.php');?>
    To explain this step.... the "include('top.php')" means that within the page it will get the content of your top.php file and insert it into the top of your php file. The same goes for the "include('bottom.php')" except it includes your bottom.php file. When you design a layout this way it makes it so if you decide to edit your pages title attribute, you open the top.php file, edit the title, and it will apply to all the pages that have the "include('top.php')".

    Hope this helps!
    Last edited by Troy297; 01-07-2007 at 09:44 PM.
    Everyone hears what you say, friends listen to what you say, best friends listen to what you don't say.
    Radio DJ Panel v3 - It's Here!

  • #7
    New Coder
    Join Date
    Jan 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •