CodeBehind Resources


Code behind pages ussually follow a standard method of storing resource files, such as templates, images, files, css, and javascript.
To make the site/control directory easier to read, it is recommend to place these files into a bin\ folder in the same directory as the CodeBehind file that uses them.

Note that this is only a recommendation, and in practice you may place resource files however you wish, including in the same folder as your CodeBehind file.

Usually your resources will be organized as follows:


|--YourPage.php
|--YourPage2.php
|--bin/
   |-- files/
   |-- images/
   |-- css/
   |-- javascript/
   |-- templates/

If two CodeBehind pages are in the same directory, they share the same bin folder. In the above example, YourPage.php and YourPage2.php would share the same bin folder.

Note that to make it easier to access your resources for a page, all templates called from within a CodeBehind page are automattically passed the template variable <?=$directory?> that resolves to the CodeBehind pages bin folder. This allows you to refer to bin files easily. For example, you could refer to an image from your template by using:


<img src="<?=$directory?>images/logo.gif">

For more information regarding templates, please see the Templates section.