I am thinking of the best way to store HTML templates in a database where I can retrieve them and include changes Able to do
Obviously I can keep them as a PHP and then 'Evil' record .... but I heard that it was bad.
Is there any better way? Edit:
Edit:
Sorry I was not clear ... I tried to simplify it by saying HTML Template ... What I really meant was small embed- Qualified HTML element (looks YouTube) ... instead of a complete site ...
Also, I will advise you to store them in a database on a file system as a template and store and include them. In a much more convenient when you need I also recommend using some kind of sense. It's a very easy tool, that's it.
However, if you want to do it manually, then that is what I do.
First of all, I store the template in a file file system if you want to use a database, this can be done simply to know that a database is usually such that When used for the goods, more land becomes the reason. For example, in the case of a YouTube video:
Then I will just type the PHP variable to str_replace
, as much as PHP does with the wires.
& lt;? Php $ template_path = 'template / youtube_vid.tpl'; $ Template_data = file_get_contents ($ template_path); $ Old = array ('{$ width}', '{$ height}', '{$ path}'); $ New = array (425, 344, 'v / zuZB2O6orV0 and HL = en_US and FS = 1 & amp;';); Echo str_replace ($ old, $ new, $ template_data); ? & Gt;
And that will happen.
You can of course & lt; Php $ width; ? & Gt; Like placeholders and just the
include
template, but it leaves you at the risk of injection attacks. This is a safe path.
No comments:
Post a Comment