rfc:shortags

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rfc:shortags [2008/04/03 20:52]
stas
rfc:shortags [2017/09/22 13:28]
Line 1: Line 1:
-====== Request for Comments: Improved short tags for templating ====== 
-  * Version: 1.0 
-  * Date: 2008-04-03 
-  * Author: Stas Malyshev <stas@php.net> 
-  * Status: Under Discussion 
  
- 
- 
- 
- 
-==== Rationale ==== 
- 
-Many template systems use PHP as its underlying language, so that the templates could be parsed and run by the efficient PHP engine, edited by PHP tools, benefit from PHP performance solutions, etc. PHP template can be written in two ways, with full tags: 
- 
-<code> 
-This is a home page for <i><?php echo $user; ?></i> 
-Last visited at <?php echo $lastvisit; ?> 
-</code> 
- 
-or short tags: 
- 
-<code> 
-This is a home page for <i><?= $user ?></i> 
-Last visited at <?= $lastvisit ?> 
-</code> 
- 
-=== Runtime short tags === 
- 
-Make short_open_tags settable in runtime, thus allowing the template engine to turn it on when parsing template, while leaving the opportunity for the user to keep it off outside template parsing. 
- 
- * **Pro**: Allows the setting to be controlled locally without the user needing to do any administration or configuration 
- * **Contra**: If the setting "leaks" (such as by template having an exception which is not properly caught by the engine, etc.) it may influence othe application parts and break them. 
- 
-=== Always available template tags === 
- 
-Make the tag **<?=** work even when short_open_tag is off, thus allowing nice templates without breaking the XML templates.  
- 
- * **Pro**: Allows the nice templates to always work, while keeping XML templates working with short_open_tag being off.  
- * **Contra**: Templates with this tag wouldn't be validated as XML, some tools may be confused by this syntax. 
- 
-=== Make other syntax === 
- 
-Make some other short XML-compliant syntax (such as **<?:**) to be used in templates. 
- 
- * **Pro**: Allows both XML checkers and template writers to be happy 
- * **Contra**: Unusual syntax not supported by 100% of tools and not familiar to 100% of users 
rfc/shortags.txt · Last modified: 2017/09/22 13:28 (external edit)