performance - PHP Template editor using file storage , database or both?


i'm really confused i want to create a browser based template editor for my php template engine. so the use can update the code from the controller panel (something like the wordpress appearance->editor)

the question is what should i use a file storage and get the template list by using glob and update the file using file_put_content and get it using file_get_contents.

or save the template names and a description for the templates in the database and store the templates in a files

or store them all in a database

i'm really confused could someone give me a good answer please (but put performance in mind i used the default php template engine because of perfromance).

Thanks in advance




If you go with flat files, you'll be able to easily leverage opcode caches like APC with on the generated templates. However, you'll also have to implement a semaphore to handle simultaneous attempts to write to the files.

Conversely with the database approach, you get mutual exclusion logic for free, but would have to write something else to create flat files in production, based on the db content, to get them APC cached.

People are also looking for solutions to the problem: php - MySQL Comma data into array, then selected


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.