The Story of CodelessUi
I wrote its first few lines of code in late 2015. And by early 2016, I had a working code I called UICast. Now it's a fully stable, open-source template engine - CodelessUi.
But it all came from an effort to solve a personal need.
I had written many templates for quite a number of websites and have seen how unnecessarily complicated it is to mix PHP and HTML together. I wanted the process of templating to be pretty straight-forward for the BraveCode Web Development Framework which I just began. So I started taking time off to write functions for a template class for BraveCode, do research and explore the options.
It would be solely for private use. But, then, in the bigger picture, everyone else is devising a means to work around this same problem - each one his favourite dish, whether good or bad. And I wished that someone set a working standard for everyone else to follow.
The Need for A Template Engine
The practice of combining PHP and HTML on templates has only, by now, piled up a handful of issues: security vulnerabilities, code complexities, and a deviation from the standards. There needed to be a clearly defined process. Consider the problems.
Security Vulnerabilities
Many security issues have been traced to badly coded templates whose inline PHP codes did override the business rules in the main application logic - things like making database calls illegally from within HTML tags. Everyone frowns on it, but as long as there was yet to be a standard to facilitate code separation and fail code combination, the issues would only increase.
Code Complexities
Then there is code complexity, which is a side effect of HTML + PHP (or HTML + the weird {tags}
of those template engines.)
The combination has always been complex even in its simplest form. So even when one is fluent in both languages, coding or reading the mix of them still poses a serious challenge - that of losing track of things here and there.
Then the challenge becomes a real problem during maintenance - after having left the code for a while. It becomes a very pains-taking undertaking!
A Deviation from the Standards
There are quite a number of template engines out there.
Their dream is not to make PHP and HTML work better together, but to lure us away from PHP altogether.
They clock time and assign teams, and they're all so similar in their complexity.
They've bred some hybrid code that's neither HTML nor PHP. A deviation from the standard!
And their template file extension is rightly .tpl
, for it couldn't have been .php
or .html
.
And with their every new release on Github being more of the same hybrid code, less of HTML, and none of PHP.
you would think that their current capabilities are all the possibilities.
Ofcourse, I did not buy the concept.
It pays me more to learn PHP and be perfect in it, than learning some other language that would not be useful for anything else other than templating.
To me, the former (templating with PHP - code separation or no code separation) is still better than the later (inline {{weird tags}}
).
We just needed to find our way back to the root.
CodelessUi!
Now we're in mid 2016, and BraveCode is a full-grown framework.
And CodelessUi was getting mature inside it. In fact using it on a real project all along helped it grow faster.
It was being built on the job, facing the real-world need for it.
Before long, it was ready as a complete engine. It met all my needs.
Everything about it revolved around the standards - built on PHP, built for plain-HTML, supports the CSS convention of element selectors, and, supports everything about XPath query for when CSS runs out of options - something I had always wanted.
Now I felt it could help someone else out there. And it being an open source project would be better - for today's web came to us open source. So I pulled CodelessUi out of BraveCode to the outside world! And although I never thought of it competing with existing template engines - it's got all the edge!
Ready to embrace the changes and the new possibilities? Head on to Github to get it! And remember to give feedback.
CodelessUi is brought to you by Oxford Harrison, the Developer of BraveCode
I hope you feel the love with which it was coded!
Are you tempted to imagine that the final blueprint has been found for a template engine? You may be right. But even at this level there are plenty of other possibilities left to explore. We still have a lot of work to do to perfect this. And you're involved! It's an open source project! And you know what that means?
- Code contribution
- Fund donation
- Feedback