Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a script, and now it's the perfect time to have an option to change theme templates.

I was looking forward to store these files in php files, or html files. with CSS file. I looked over some codes and I found that they use brackets to refer to the variable.

Here's an example of a template block:

<div class='block_div'>
<center>{title}</center>
{content}
</div>

I know that I can use PHP vars usering <?=$var;?>. However, I think the one above is better, and I looked over the web to find anything about it but I couldn't.

My Question is how I can use these brackets in my php or html code. to let the user changing the template only not the code!

share|improve this question
    
...and your question is...? –  Walter Dec 17 '12 at 0:27
    
My Question is how I can use these brackets in my php or html code. to let the user changing the template only not the php code! –  Othman Dec 17 '12 at 0:37
add comment

closed as off topic by Walter, Glenn Nelson, thorsten müller, Dynamic, GlenH7 Dec 17 '12 at 14:29

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 0 down vote accepted

I don't think this question belongs to this site but to stackoverflow. Anyway, I'd tell you to take a look at any of the several templating libraries out there, for both PHP and JavaScript, such as:

  • For PHP: twig, smarty, etc.
  • For JavaScript: mustache.js, handlebars.js
share|improve this answer
    
Thank you so much, that's what I was looking for. –  Othman Dec 17 '12 at 0:54
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.