Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6837781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:31:05+00:00 2026-05-26T23:31:05+00:00

A while ago I built a fan site for a PC game, and I

  • 0

A while ago I built a fan site for a PC game, and I believe that it could be set up better. Basically, right now all of my pages share a common header and footer, and the only real difference between pages is the content loaded into a main table cell.

Currently, I am trying to make ‘clean’ URLs by having each page in its own directory with an index.php file.

For example, my ‘About’ page is located in /about/index.php, but it can be accessed by just going to /about

Here is how the index.php looks inside of the ‘about’ directory:

<?php include '/home/content/69/7232369/html/loco_header.html' ?>
<tr><td>
    <table class="mainpagetable">
<tr>
    <td class="maincontent">
        <table class="contenttable" >
            <tr><td><div class="contenttop"><span class="newheader">About</span></div>
            <div class="contentmiddle" id="contentmiddle">
            <table class="newcontent">
            <tr><td>
            <br>
            <?php include 'about.html'; ?>
        </td></tr>
        </table>
        </div>
        <div class="contentbottom"></div></td></tr>

</table>

            </td>
    <td class="gap">

    &nbsp;</td>
<?php include '/home/content/69/7232369/html/site_footer.html' ?>

So basically, I created the entire layout in HTML, separating the parts of the site by using tables within tables. I have a PHP include for the header, the page content, and the footer. All of my pages look like this, and it seemed like a good approach at first, however I recently switched to a different host and when I copied everything over, none of the includes for the headers/footers worked because of the different path to the root directory:

<?php include '/home/content/69/7232369/html/loco_header.html' ?>

Which was a pain to go through 100+ php files and change the header/footer include on each of them one by one. It was then that I realized I am probably doing something wrong.

So my questions are:

1) Is there function in PHP that returns the root directory for your website, so that I could do something like include $root . “/header.html” ?

2) My method for creating clean URLs creates quite a bit of extra directories and files. Is there a different recommended approach that I can take which would run smooth and generate less files (while still being search engine friendly)?

3) Is there more efficient/more manageable approach for loading the content into the center of my page, that would also work nicely with a method for having clean URLs (see question #2)? AJAX comes to mind, however I would like there to be an actual URL link to each content page, rather than having everything loaded dynamically in the middle of my home page without the URL changing. I honestly don’t know if there is a good solution to this.

4) Is it considered poor practice to use tables within tables for structuring my layout? As you can see, I am splitting up my HTML code in the middle of table tags and placing it in 3 different files (header, index, footer) to structure my site. This seems bad to me.

If it helps to clarify the structure of my pages, here is a link to a page on my site: http://locohq.com/about/

Any help is appreciated, thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:31:06+00:00Added an answer on May 26, 2026 at 11:31 pm

    I ended up removing all of my tables and replacing them with elements and properly structuring using CSS.

    For loading my content, I just made a main index page with a “content” container in the center of it. Within that container, I put a simple block of PHP code:

    <?php 
            if(isset($_GET["content"])){
                $file = $_GET["content"] . ".php";
                if (file_exists($file))
                    include($file); 
                else
                    echo "Cannot find page <b>" . $_GET["content"] . "</b>";
            }
            else
                echo "No content loaded";
    ?>  
    

    Basically I load content into my page by linking to main.php?content=page and the code from whatever the content is gets loaded into the container.

    To get around the ugly URL, I used mod_rewrite and put this into my .htaccess

    RewriteEngine On
    RewriteBase /
    RewriteRule ^([a-zA-Z0-9]+)$ pages/main.php?content=$1
    

    So if I entered a URL as http://www.example.com/about it would load http://www.example.com/pages/main.php?content=about and then the code inside of the file /pages/about.php would get loaded into my content container. If the user tries to go to a page that doesn’t exist, it will load the main page and inside of the content container, it will display a message that the page they are looking for doesn’t exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A while ago, I saw on a Screencast a tool that could be ran
I have an SQL query that I built for a tool a while ago
A while ago, I came across some code that marked a data member of
A while ago I had a query that I ran quite a lot for
A while ago, I set up my company's local (non-internet) client database on my
A while ago another question referred to the (possibly urban tale) statistic that ...
I Built an IoC container long time ago while watching this show http://www.dnrtv.com/default.aspx?showNum=126 few
A while ago I found a packaging tool for visual studio that allowed quite
A while ago I came across this answer that introduced me to the obscure
Some years ago I built an Excel file for my colleagues that displays lots

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.