CSML

CSML is a little class (PHP5 only) that generates HTML tags from CSS-like selectors.

download-button

Why? Because I hate having HTML mixed up with PHP on my templates. I particularly hate how popular wordpress themes and plugins are coded where is dificult to follow conditional statements and loops starts or ends, because they are all scrambled with HTML tags.

With CSML, you can generate necessary HTML tags using CSS selectors inside your PHP code-blocks without escaping or concatenating long strings. If you already know some CSS, this syntax should be very easy to understand. 

The class has two main methods: csml::tag() generates a tag from a selector and csml::entag() wraps a string into a pair of selectors.

Here's an example:

Included with the class, there are to utility functions: t() and en() wich print the results from csml::tag() and csml::entag() respectively. This makes code even easier to write.

There's more documentation and samples on the project's README

download-button

Posted