Posted by Michael Fesser on 10/11/07 12:16
..oO(Francesco)
>Hi there!
>I'm trying to organize my sources into a webroot tree like this,
>
>webroot
> index.htm - only contains index.php into a frame
> index.php - require_once('inc/layout.php')
>
> home
> page1.php - require_once('../inc/layout.php')
> page2.php - require_once('../inc/layout.php')
> page3.php - require_once('../inc/layout.php')
>
> inc
> config.php
> layout.php - require_once('redirect.php')
> redirect.php - require_once('config.php')
>
>
>config.php
>contains all the settings... the list of pages and other stuff.
>
>layout.php
>is the layout used to draw pages.
>
>redirect.php
>contains the functions that I use to browse the site.
>
>I have some questions for yoy:
>
>1. is that a good way to structure the site?
No.
1) Why frames?
2) Why a 'home' directory?
3) The 'inc' directory should be stored outside the document root for
security reasons.
>2. what about the require_once function?
> I mean is it safe to use relative path?
I always use absolute paths, based on $_SERVER['DOCUMENT_ROOT']. My init
scripts defines some constants, so it's very easy and convenient to load
files from my different paths.
>3.What would be te best strategy to manage this structure?
This is the usual structure on my sites:
/example.com - the site directory on the server
/etc - configuration files
/include - all the necessary scripts and components for this site
/classes
/modules
/templates
/public - the document root
/css
/images
/scripts
.htaccess
index.php
robots.txt
...
Micha
Navigation:
[Reply to this message]
|