Ben basit bir web sitesi geliştiriyorum. Bu 20 sayfa yakın olacaktır. Bu 3 seviyeli hiyerarşi vardır.
Home
MenuStub
Category1
Page1
Page2
Category2
Page1
Page2
....
....
....
The main navigation will have 4 - 5 items representing each 'category' This will be constant for all the pages. I am not even planning to highlight the current category or anything.
Previously I decided to put the menu HTML stub alone in a separate file and use PHP include to include it in all pages.
But, relative paths might be frustrating. Assume that the menu stub file is located at the root directory.
Yani, kök düzey sayfalarında, php gibi okuyacak dahil
include "menustub.html";
ikinci düzey sayfalarında, o demeliyim
include "../menustub.html";
ve üçüncü düzey sayfalar, bu demeliyim
include "../../menustub.html";
First, is this the best way to include a single file across all pages in a website?
Second, if the website grows big, and many more levels are added, maintaining this will be a problem. If I suddenly decide to move an entire set of pages one (or several) levels up or down, I should manually go and change the relative paths in each file.
Am I missing something here? Is there a universal way to point to a particular file, that every page will understand, regardless of where it is located?
What is the best way to have a stub and include it in all the pages without having these maintenance nightmares?