Chapter 6. Directory structure of Tangra based site / application

Table of Contents

Introduction
/ - root directory
/htdocs
/hidden
/ext_inc
/scratch

Introduction

General idea of directory structure of each site / application (Tangra based or not) is to be logical and in the same time convenient for development, deployment and maintenance.

Usually when site is developed that happens on inhouse development server for which you have (directly or indirectly (via coleague sysadmin)) full control. In case that there is a conflict between configuration required by the site and the configuration of the server - you can easyly change the server configuration to reflect your needs. Of course, that is not the case when it comes to deployment. Most sites are installed on so called "shared hostings" where server configuration is "locked" and it is almost impossible to convience hosting company to change it. Because of that directory structure of Tangra site was developed with flexibility in mind. Directory structure of a new site is provided by module directory_structure_base.

Top levels directories of each Tangra site are:

  • /htdocs - contains html, php, image, css, js library files. Sometimes is mentioned as "document root".
  • /hidden - contains all *.class.php and *.inc.php files, configuration files, template files (Tpl files). The name "hidden" comes from the security requirement to hide the php code and configuration files from direct access via web server.
  • /scratch - this directory is used for storage point of downloaded or temporary files. Also contains *.log and debug files. In production environment only this dir must have write permissions (writable by the webserver).
  • /ext_inc - this is the place for third party PHP libraries. The name ext_inc comes from "external include directory".

Note: Please note that paths of the above dirs are not fixed. For example your /htdocs may be /public_html or /www.

Important

Please note that in many dirs there is subdir modules. Such subdirs are used solely by modules and usually you don't have work there.