This blog has moved here: woorkup.com | FOLLOW ME ON TWITTER @woork
Friday, October 5, 2007

A typical website structure

This is a typical website structure that I use in my web projects. To create this structure using Dreamweaver, select from the menu the option Windows > Files and start creating new pages and folders.



- index.php is the "container" of your site. Inside this page we will define the page's principal sections (topbar, navigation's bar, main content, footer);

- config.php contains the connection's strings for MySQL database (host name, user, password);

- image folder contains all the graphical elements for your site (gif, jpeg, png);

- css folder contains the style sheets files (.css);

- include folder contains all the web pages that will be loaded into the index.php "main content" section using URL variables.

See also: Load pages using URL variables and PHP include() function

blog comments powered by Disqus
Alex Mcvitie said...

This is awesome, exactly what i have been looking for, im just begining to learn php and this is a great tutorial, please do more :)

Anonymous said...

I'm learning to build a website. If you do this, the title tag will be the same for all pages in the website? If you use a GET in index.html, how does a form/POST work in the content in one of the pages?

Andy said...

shouldn't config.php with passwords be out of the public folders or at least behind a protected folder

zotium said...

Hey Antonio,

The problem is, when editing the include files if they have images that reside in the /images folder, you wouldn't be able to see the images.

How do you work around this problem?

Anonymous said...

(@zotium: you will as long as you use absolute paths instead of relative.)

This is exactly how I organize my website but two things though:
1)I put my config file inside the "includes" folder and protect this folder and all it contains with an .htaccess file.
2)To organize your site the way you suggest, there's more to do about security. You should make sure that the user can only access the included files within the index one and redirect him to the root in any other case.

Phil de Somerset said...

Hi,

Slightly off topic, but could you tell me what software you used to create the site diagram in this post?

Your tutorials are very good by the way.

Thanks

Phil

  • Twitter Follow woork on Twitter
  • RSS Feed Subscribe to stay up to date
  • Podcast Coming soon...
  • 0 delicious lovers save
Share your links. Do you want to suggest any interesting link about web design or tech news? Submit your link.
Submit a News