how to organize files created dynamically using php?
<p>I have an PHP website which creates and stores HTML template files on server based on user input.one user can create many templates.So to store the template files and associate them with the DB record ,what I do is-</p>

<p>"templates" is the table which hold other information about the template such as who created it etc. with unique auto-increment id as template_id</p>

<p>for example -
if template id is 1001 
I convert it to hex which is 03e9
Now I split the hex number into  03 &amp; e9 (after two numbers) becomes folder and e9 becomes
file with some extension as "e9.tpl"</p>

<p>This is how I can find out template from the file system if I know the template ID.I dont need to separately store the path to the file.</p>

<p>is it a good approach ? any shortfalls of this approach ? is there any other approach better than this ?</p>

<p>What are the advantages / disadvantages of storing the path to file in the database itself ? for example to enable using different discs serving templates etc.?</p>
