|
From: Henry S. <kel...@ph...> - 2009-08-24 15:13:01
|
Author: Kellanved
Date: Mon Aug 24 16:12:40 2009
New Revision: 10051
Log:
Add INC (working name) to template syntax
Modified:
branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html
branches/phpBB-3_0_0/phpBB/includes/functions_template.php
Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
==============================================================================
*** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original)
--- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Mon Aug 24 16:12:40 2009
***************
*** 281,286 ****
--- 281,288 ----
<li>[Feature] Separate PM Reply and PM Reply to all in prosilver.</li>
<li>[Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.</li>
<li>[Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...</li>
+ <li>[Feature] Added INC command to template syntax.</li>
+
</ul>
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
Modified: branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html
==============================================================================
*** branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html (original)
--- branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html Mon Aug 24 16:12:40 2009
***************
*** 1174,1180 ****
<span class="comment"><!-- DEFINE $SOME_VAR = 'my_file.html' --></span>
<span class="comment"><!-- INCLUDE {$SOME_VAR} --></span>
</pre></div>
!
<h4>PHP</h4>
<p>A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:</p>
--- 1174,1185 ----
<span class="comment"><!-- DEFINE $SOME_VAR = 'my_file.html' --></span>
<span class="comment"><!-- INCLUDE {$SOME_VAR} --></span>
</pre></div>
! <p>Also added in <strong>3.0.6</strong> is the ability to increment an variable on use. This can be used for instances like tabindexes, where the amount of entries is not statically known.
! The INC command will print the current state of a defined var and then increment it by one (postincrement).</p>
! <div class="codebox"><pre>
! <span class="comment"><!-- DEFINE $SOME_VAR = 1 --></span>
! <span class="comment"><!-- INC $SOME_VAR --></span>
! </pre></div>
<h4>PHP</h4>
<p>A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:</p>
Modified: branches/phpBB-3_0_0/phpBB/includes/functions_template.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/functions_template.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/functions_template.php Mon Aug 24 16:12:40 2009
***************
*** 191,196 ****
--- 191,200 ----
$compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], false) . ' ?>';
break;
+ case 'INC':
+ $compile_blocks[] = '<?php ' . $this->compile_tag_counter($block_val[2], true) . ' ?>';
+ break;
+
case 'INCLUDE':
$temp = array_shift($include_blocks);
***************
*** 626,631 ****
--- 630,651 ----
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';';
}
+
+ /**
+ * Compile INC tags
+ * @access private
+ */
+ function compile_tag_counter($tag_args)
+ {
+ preg_match('#^\$(?=[A-Z])([A-Z0-9_\-]*)$#', $tag_args, $match);
+ if (empty($match[1]))
+ {
+ return '';
+ }
+
+ return 'echo $this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[1] . '\']++';
+ }
+
/**
* Compile INCLUDE tag
* @access private
|