I am in the process of redesigning my website and I decided I would take my time and try and learn a few things. One of the things I wanted to learn was at least some basic php. Long story short, Im trying to use includes for content, menus and such. And in that process, it occurred to me that I had seen an example in a book where they used includes to build the page template as well so I thought why not.
Well, in the process of doing this the more pages I created the harder it became to keep track of how many '../' was I going to have to use to get the links to refer to the points I wanted in the site structure. A google search lead me to
Which in turn led me to the use of:
Code: Select all
<?php include ($_SERVER['DOCUMENT_ROOT'].'/file/location.php');
That in turn got me to thinking, but unable to find a solution thus far is how can I declare document root globally for the entire page so that I dont have to write for each include
? Im not sure it can be done, just asking and keep in mind Im new to all this but trying to learn. I guess Im just trying to make the code more efficient and Im not sure there would be any reason to declare such a thing just one time for the whole page.
Anyway, I'll stop there and see what I need to do or if there are any options. Thanks in advance for your help.