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 9082067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:28:06+00:00 2026-06-16T20:28:06+00:00

I am building a website and would like to ask something about best practices

  • 0

I am building a website and would like to ask something about best practices when having pages in different folders.

In my case, I would like to have a page in ../store/ and I have called it index.php.

This page loads external content, for example, the Header which is stored in the parent directory ../ along with some other pages. These pages loaded are used by other pages located in other subfolders.

The question is : Is it a better practice to have the Header (for example) replicated in each of the subfolders where an page is stored and will be using it?

Meaning I would call the header as header.php. Or is it better to have just 1 header in the parent and call it every time as ../header.php ?

———— UPDATE

In my site, I have an index.php in the parent directory. This index.php has a include that calls adds commonItems/header.php. At the same time, this header.php has a <?php include("commonItems/menu.php"); ?> to add the menu.

Then there is a folder in the parent that is called store/ in which I have another index.php which also adds ../commonItems/header.php. However, in this case, the header is added properly but the menu.php does not show up….

Any idea of how to solve this?

  • 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-06-16T20:28:07+00:00Added an answer on June 16, 2026 at 8:28 pm

    There is no point in having multiple php pages with the same content in different folders, especially if you are going to use them across the website.

    In case of changes/maintainability, you’ll have to make changes across all the folders where these files are located, which would make it very difficult to maintain.

    So, if you use a file across various pages, might as well, put it in one place and call it from across the website.

    To call them, I usually prefer to define a constant and use that, so :

    define('COMMON', $_SERVER['DOCUMENT_ROOT'] . 'common/');
    ...
    require COMMON . 'header.php';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a mobile first website using Susy and would like to have
I am building a website and I would like to add a dark semi-transparent
I am building a website which I would like to behave responsively using CSS
I'm building a website that will require user registration and logon. I would like
I'm building a really simple CMS for a bilingual website. The website would have
Say I was building an e-commerce website, how would I go about recording the
I'm building a website, and would like to make aa navigation bar with submenus.
I building a simple, 7 page, database driven, website, and I would like to
I'm building a website and would like to do some input testing on it.
I'm building the following project website http://hpsfo.bitbucket.org and would like to add the twitter

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.