Some time ago I heard that some web designers tend to put some of their files inside folders and name them index so that the user can easily navigate to that part of the website just by typing a short address. E.g if i had a page called about.php i can move it to a folder about/index.php and rename it. So it sounded like a good idea at the time, still does abit. But if you think about it (or in my case try to do it :S), and your file system looks something like this (most websites have those pages):
You will realize that you cannot just use the same header.tpl and footer.tpl for all the pages on your website, because the relative paths don't work, unless you come-up with a work around to do it. Frankly, Iím kinda tired of coming up with these workarounds, and i thought there has got to be a better way to do this then to add another variable in the template-- $relative_path.
The problem is that i want to use some of the features (like the poll or display apart of the forum -- recent posts) on the main page /index.php. But at the same time I want to keep all the files packaged inside a folder so that they can be easily moved to another project if I need to use these features.
I thought of doing it maybe like some programs do it (e.g like eclipse downloads work), keep all the, letís say poll files inside a zip file poll.zip which will look like this inside:
/admin/ /classes/ /plug-ins/ /template/
And I would just extract it where on the website i need it and use it like that. But again it's not that simple, not as simple as a desktop application or at least that what it seems to me.
So what Iím asking is basically, how do you do it? And also can you please give me some guidance as for how to build a good file system for a website. Iím getting really lost here .
I am using PHP 5, MySQL and Smarty for my website, but it can easily apply to ASP.net or other server side script languages/databases/templating engines. But if you have any advice regarding the use of the above technologies, i would appreciate it . Hope you will understand what i'm talking about here, it is really hard to put into words.
This post has been edited by Mike007: 20 February 2008 - 11:24 PM