Separating Code from Content

How do you separate the 2 Cs (Content and Code)?

  • I don't separate them, they are both in the same file (close tag, output content, open tag).

    Votes: 0 0.0%
  • I generate my content in the same file, but entirely with code (the print function, or echo).

    Votes: 2 33.3%
  • I separate the content from the code, and I load templates on which I apply content.

    Votes: 3 50.0%
  • What are you talking about?

    Votes: 1 16.7%

  • Total voters
    6

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
I've seen some tutorials, some programs, etc. that mix up content (html in this case) and code (php here). For instance, they would start an IF clause, close the php tags, put in some html, reopen the php tags and close the IF block.
I find this practice bad, because the code and the content are embedded into each other. Here is my call:

If you want to generate all the html from server-side code, output it normally, but if you want to separate the code, the content (, etc.), then use a templating system, or create one.

What's your call.
 

ichwar

Community Advocate
Community Support
Messages
1,454
Reaction score
7
Points
0
If I understand what you are asking, I have my content and code on different pages and then use more code, primarily php includes and the like, to combine them in certain orders to make my different pages.

Is that what you are asking, or am I missing something?
 
Top