# Directory structure

This documentation is outdated.

## Preface

The overall directory structure seems to be complex and redudant. The reason for this is that we still have to support the directory structure of previous source codes. Some of these directories can be removed in future when the old source codes have been updated to use the current template engine. Some other directories should be kept in future, because some geocache listings or other website may reference to files inside that directories. This document will first explain the currently intended directory structure and after that explain the obsolete directories. You should only use the new directory structure in new developments.
All directories in this document will reference to trunk as base directory. Other branches and tags should use the same directory structure.

## Directories

### code

All files that have to be uploaded to the webserver are contained in this directory.

### code/bin

Command line utilities for Opencaching administration and utlilities used by the PHP code. This directory should only contain the binary itself. Config files and libraries should be placed in the appropriate directory.

### code/config

Contains configuration files. The source code is delivered with an default configuration (settings-dist.inc.php). In the local webserver configuration (settings.inc.php) only values have to be included that differ from the default configuration. An example of this configuration is delivered with (settings-sample.inc.php).

### code/htdocs

This directory should be the document root of the apache configuration. Only these files have to be accessible for web users.

### code/lib

Contains Opencaching business logic files and classes.
Subdirectories may be created for storing a set of classes that contain to the same functionality like "search modules".

### code/template

Smarty HTML templates.

### code/upload

Directory containing all files that the users have uploaded. A seperate structure of subdirectories may be created for each upload functionality (e.g. GPX files or images).

### code/webcache

Directory for caching files used to generate or speed up site processing. Like compiled smarty files or caching of the menu structure.

### documentation

See documentation for details.

### resource

Contains files that were used to generate images and other "generated content".
Subdirectory structure may be used where appropriate.

## Obsolete directories

Existing sources have been copied to code/htdocs because in previous codes, there was no strict seperation between "inside" and "ouside" the public accessbile root directory of the web server.

There are 2 template engines used in the opencaching source code.
The first one is a self-written template engine (refered as "old") and the second one is smarty (refered as "new").
You can determine what source code is used when you look into the first code lines of the file. If the soruce file includes "lib/common.inc.php" the old template system is used. If it includes "lib2/web.inc.php", the new template engine is used.
Directories ending with "2" belong to the new template engine. Directories without a "2" at the end belong the the old template engine.

### code/htdocs/cache

### code/htdocs/cache2

### code/htdocs/cache2/smarty/cache

### code/htdocs/cache2/smarty/compiled

### code/htdocs/cache2/translate

### code/htdocs/config2

### code/htdocs/doc

### code/htdocs/doc/sql/static-data

### code/htdocs/doc/sql/stored-proc

### code/htdocs/doc/sql/tables

### code/htdocs/doc2

### code/htdocs/doc2/images

### code/htdocs/download

### code/htdocs/html

### code/htdocs/images

### code/htdocs/lang/de/ocstyle

### code/htdocs/lang/de/ocstyle/email

### code/htdocs/lang/de/ocstyle/images

### code/htdocs/lang/de/ocstyle/js

### code/htdocs/lang/de/ocstyle/lib

### code/htdocs/lib

### code/htdocs/lib2

### code/htdocs/lib2/logic

### code/htdocs/resource2/misc

### code/htdocs/resource2/ocstyle

### code/htdocs/resource2/tinymce

### code/htdocs/statpics

### code/htdocs/templates/mail

### code/htdocs/templates/ocstyle

### code/htdocs/templates/ocstyle/articles

### code/htdocs/util

### code/htdocs/util2

### code/htdocs/xml