Jump to content

how to include menu.html from diff. Subfolder Level and mantain same behaivor


Correohs

Recommended Posts

Help needed.

I have 3 domains pointing same directory in my webserver (ISP)

mysite.com

mysite.net

mysite.info

 

I wanted to use (1) one menu file for all of them, that I load it to the include subfolder.

 

mywebsite structure

 

/index.php  ( I use include $_SERVER['DOCUMENT_ROOT']."/include/menu.html"; )

/about.php ( I use include $_SERVER['DOCUMENT_ROOT']."/include/menu.html"; )

/contactus.php ( I use include $_SERVER['DOCUMENT_ROOT']."/include/menu.html"; )

/(more files) ( I use include $_SERVER['DOCUMENT_ROOT']."/include/menu.html"; )

/link/

/link/index.php ( I use include $_SERVER['DOCUMENT_ROOT']."/include/menu.html"; )

/link/(more php files) ( I use include $_SERVER['DOCUMENT_ROOT']."/include/menu.html"; )

/include

/include/menu.html

 

Menu File Structure

    <li><a href="aboutus.php">ABOUT</a>

    <ul><li><a href="aboutus.php">ABOUT US</a></li>

        <li><a href="contactus.php">CONTACT US</a></li>

          <li><a href="testimonial.html">GUEST BOOK</a></li>

 

      </ul>

    </li>

 

from my php application I use

include $_SERVER['DOCUMENT_ROOT']."/include/menu.html";

 

Pages on root directory are working well.

/aboutus.php

/contactus.php

/testimonial.html

 

when I'm on  /link  directory (subfolder )I got problems

the menu will point to.

/link/aboutus.php

/link/contactus.php

/link/testimonial.html

 

Getting page no found.

 

if I'm in a subfolder, how can I do to call the include file, and preserver the root path automatically.

 

---- let me try to make simpler ----

3 mysites domain 

mysite.com mysite.net mysite.info

.com .net .info

 

/

/index.php

/about.php

/contactus.php

/testimonial.html

/(more files)

/link/

/link/index.php

/link/(more php files)

/include/menu.html

 

How can I call /include/menu.html from any directory level and maintain same behavior?

------

 

Thanks!

CorreoHS

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.