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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:32:13+00:00 2026-06-06T06:32:13+00:00

I have a file called header.php that I am including on every page on

  • 0

I have a file called “header.php” that I am including on every page on my site and this file contains links to other files on my sever like css files, jquery plugins, etc.. and right now I am using absolute paths for those links so they will work with files that are not in the same directory as the header.php file and this works, but as you can see in the example below, things start to get really hard to manage if you your header.php file contains lot’s of links (which mine does) so I would like to know if there are any other alternatives to using absolute paths in the header.php file like I have done here.

header.php

<? 
 $base_url = "http://example.com";
?>
    <html>
      <head> 
       <title> <? echo($title); ?> </title>

        <link rel="stylesheet" type="text/css" href="<? echo($base_url); ?>/styles/some_css_file.css" media="all"/>
        <link rel="stylesheet" type="text/css" href="<? echo($base_url); ?>styles/another_css_file.css" media="all"/>
        <link rel="stylesheet" type="text/css" href="<? echo($base_url); ?>styles/another_css_file.css" media="all"/>
        ...
        ...
        ...

        <script type="text/javascript" src="<? echo($base_url); ?>/scripts/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="<? echo($base_url); ?>/scripts/some_jquery_plugin.js"></script>
        <script type="text/javascript" src="<? echo($base_url); ?>/scripts/another_jquery_plugin.js"></script>
        ...
        ...
        ...
      </head>

Some file which includes header.php

<? 
  $title = "some page title";
  include("header.php"); 
?>

      <body>
        PAGE CONTENTS
      </body>
    </html>
  • 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-06T06:32:15+00:00Added an answer on June 6, 2026 at 6:32 am

    Use the HTML base tag to define the base of your site.

    <base href="<?php echo $base_url; ?>" />
    <link rel="style.css" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this page called up.php that adds 1 to a txt file set
I have a file that is called header (the header of my site).. I
I have a file called bbUI.js which contains this bit of JavaScript. Outside of
I currently have code like this in a web based file called 'view_file.php' to
I have a global.php file that I call from the top of every script.
I have a page called example1.php . This page calls another page with some
I have a file called header.html and it is included by base.html . In
I have some useful typedefs on a header file called utypes.h. I have decided
I have a file called error.log on my server that I need to frequently
I have a file called 34.php?session=2534464a39a2c97cb7113689726a4e52 in my /var/www/html folder but I can't view

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.