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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.