WordPress is not PHP, a basic template tutorial.
While I respect what the guy is trying to say, he is wrong in saying WP is not PHP. It is PHP. And the template tags, though called template tags, are PHP functions built by the WP team using PHP. It’s like saying a leopard isn’t a leopard but a cat.
It’s way too oversimplified.
It’s like phpBB template variables. They’re built by the phpBB PHP files, yet they’re used in and surrounded by (X)HTML.
Well, I don’t agree with you Aaron[& you can’t give me negative rep here for arguing with you 😉 ]. Even if its a PHP function call, can’t it be used as a template tag? Its static, its not changing & you use it as it is, copy paste. Then why all the fuss about it? Does WP necessarily have the overhead of a templating system like Smarty for proper templates? That would really affect the speed of WP.
There’s nothing really wrong in using PHP function calls as template tags as WP does. If a designer don’t want to learn PHP to create themes, then its ok, he can simply copy-paste the tags, they are documented at the Codex at http://codex.wordpress.org/Templates. 🙂
It is PHP since the underlying language used is PHP itself. Even though you can freely use (X)HTML, this is a direct benefit of PHP’s ability to interact so closely with (X)HTML. phpBB’s template variables differs in this respect since there’s an external script written to convert the phpBB template variables to actual values, while there’s no equivalent being done to WordPress’s templates since they’re PHP calls already.
It’s incorrect to imply that templates necessarily result in slower speeds. Smarty, for instance, only parses user templates once to create a cache file, which is basically a PHP file with all template tags replaced with PHP variables. This end result is the same as WordPress, but the designer (i.e. person editing the template) is insulated from having to work with PHP. Another example is LightPress, a template-based frontend replacement for WordPress that was recently benchmarked at over triple the speed of WordPress.
Templates are a way of separating the engine code from the site design & layout. It’s a usability issue from the designer’s point of view. If your “template tags” are really just PHP code, then the designer has to worry about syntax: “Did I forget a semicolon?” And once code permeates the design, it inevitably spreads.
I agree that a badly-designed template system would be slow. But I don’t see anyone suggesting the use of such a system.
I might be true that WordPress is not PHP because wordpress is not really the PHP nor the PHP is the WordPress. But the truth is WordPress uses PHP and was built through PHP….
Thanks for the tutorial.
Comments are closed.