fixed PHP_VERSION check, misc doc updates

This commit is contained in:
mohrt
2001-01-29 23:08:50 +00:00
parent a1c4060238
commit fdef1c65b1
5 changed files with 20 additions and 12 deletions

15
FAQ
View File

@@ -16,15 +16,16 @@ A: Most other template engines for PHP provide basic variable substitution and
scalable and managable for large application needs. scalable and managable for large application needs.
Q: What do you mean "Compiled PHP Scripts" ? Q: What do you mean "Compiled PHP Scripts" ?
A: What this means is that Smarty reads the template files and creates PHP A: Smarty reads the template files and creates PHP scripts from them. Once
scripts from them. Once these PHP scripts are created, Smarty executes these PHP scripts are created, Smarty executes these, never having to parse
these, never having to parse the template files again. If you change a the template files again. If you change a template file, Smarty will
template file, Smarty will recreate the PHP script for it. All this is done recreate the PHP script for it. All this is done automatically by Smarty.
automatically by Smarty. Template designers never need to mess with the Template designers never need to mess with the generated PHP scripts or even
generated PHP scripts or even know of their existance. know of their existance.
Q: Do you have a mailing list? Q: Do you have a mailing list?
A: Yes. Subscribe by sending an e-mail to subscribe-smarty@lists.ispi.net A: Yes. Subscribe by sending an e-mail to subscribe-smarty@lists.ispi.net. This
is also archived at http://marc.theaimsgroup.com/ under www/smarty
TROUBLESHOOTING TROUBLESHOOTING
--------------- ---------------

5
NEWS
View File

@@ -1,3 +1,8 @@
Version 1.2.2
-------------
- fixed bug using $PHP_VERSION instead of environment var PHP_VERSION.
- couple small warning fixes
Version 1.2.1 Version 1.2.1
------------- -------------
- added $compile_dir, removed $compile_dir_ext, simplified usage - added $compile_dir, removed $compile_dir_ext, simplified usage

2
README
View File

@@ -2,7 +2,7 @@ NAME:
Smarty - the PHP compiling template engine Smarty - the PHP compiling template engine
VERSION: 1.2.0 VERSION: 1.2.1
AUTHORS: AUTHORS:

View File

@@ -281,7 +281,6 @@ class Smarty
$new_dir = ""; $new_dir = "";
foreach ($compile_dir_parts as $dir_part) { foreach ($compile_dir_parts as $dir_part) {
$new_dir .= $dir_part."/"; $new_dir .= $dir_part."/";
echo "DEBUG: $new_dir<br>\n";
if (!file_exists($new_dir) && !mkdir($new_dir, 0755)) { if (!file_exists($new_dir) && !mkdir($new_dir, 0755)) {
$this->_set_error_msg("problem creating directory \"$this->compile_dir\""); $this->_set_error_msg("problem creating directory \"$this->compile_dir\"");
return false; return false;
@@ -357,6 +356,8 @@ echo "DEBUG: $new_dir<br>\n";
$this->_current_line_no += substr_count($template_tags[$i], "\n"); $this->_current_line_no += substr_count($template_tags[$i], "\n");
} }
$compiled_contents = "";
/* Interleave the compiled contents and text blocks to get the final result. */ /* Interleave the compiled contents and text blocks to get the final result. */
for ($i = 0; $i < count($compiled_tags); $i++) { for ($i = 0; $i < count($compiled_tags); $i++) {
$compiled_contents .= $text_blocks[$i].$compiled_tags[$i]; $compiled_contents .= $text_blocks[$i].$compiled_tags[$i];
@@ -857,7 +858,7 @@ echo "DEBUG: $new_dir<br>\n";
/* preg_grep() was fixed to return keys properly in 4.0.4 and later. To /* preg_grep() was fixed to return keys properly in 4.0.4 and later. To
allow people to use older versions of PHP we emulate preg_grep() and allow people to use older versions of PHP we emulate preg_grep() and
use the version check to see what function to call. */ use the version check to see what function to call. */
if (strnatcmp($PHP_VERSION, '4.0.4') >= 0) { if (strnatcmp(PHP_VERSION, '4.0.4') >= 0) {
$var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:[^|]+)?)*$!', $tokens); $var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:[^|]+)?)*$!', $tokens);
$conf_var_exprs = preg_grep('!^#(\w+)#(?>\|@?\w+(:[^|]+)?)*$!', $tokens); $conf_var_exprs = preg_grep('!^#(\w+)#(?>\|@?\w+(:[^|]+)?)*$!', $tokens);
$sect_prop_exprs = preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:[^|]+)?)*$!', $tokens); $sect_prop_exprs = preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:[^|]+)?)*$!', $tokens);

View File

@@ -281,7 +281,6 @@ class Smarty
$new_dir = ""; $new_dir = "";
foreach ($compile_dir_parts as $dir_part) { foreach ($compile_dir_parts as $dir_part) {
$new_dir .= $dir_part."/"; $new_dir .= $dir_part."/";
echo "DEBUG: $new_dir<br>\n";
if (!file_exists($new_dir) && !mkdir($new_dir, 0755)) { if (!file_exists($new_dir) && !mkdir($new_dir, 0755)) {
$this->_set_error_msg("problem creating directory \"$this->compile_dir\""); $this->_set_error_msg("problem creating directory \"$this->compile_dir\"");
return false; return false;
@@ -357,6 +356,8 @@ echo "DEBUG: $new_dir<br>\n";
$this->_current_line_no += substr_count($template_tags[$i], "\n"); $this->_current_line_no += substr_count($template_tags[$i], "\n");
} }
$compiled_contents = "";
/* Interleave the compiled contents and text blocks to get the final result. */ /* Interleave the compiled contents and text blocks to get the final result. */
for ($i = 0; $i < count($compiled_tags); $i++) { for ($i = 0; $i < count($compiled_tags); $i++) {
$compiled_contents .= $text_blocks[$i].$compiled_tags[$i]; $compiled_contents .= $text_blocks[$i].$compiled_tags[$i];
@@ -857,7 +858,7 @@ echo "DEBUG: $new_dir<br>\n";
/* preg_grep() was fixed to return keys properly in 4.0.4 and later. To /* preg_grep() was fixed to return keys properly in 4.0.4 and later. To
allow people to use older versions of PHP we emulate preg_grep() and allow people to use older versions of PHP we emulate preg_grep() and
use the version check to see what function to call. */ use the version check to see what function to call. */
if (strnatcmp($PHP_VERSION, '4.0.4') >= 0) { if (strnatcmp(PHP_VERSION, '4.0.4') >= 0) {
$var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:[^|]+)?)*$!', $tokens); $var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:[^|]+)?)*$!', $tokens);
$conf_var_exprs = preg_grep('!^#(\w+)#(?>\|@?\w+(:[^|]+)?)*$!', $tokens); $conf_var_exprs = preg_grep('!^#(\w+)#(?>\|@?\w+(:[^|]+)?)*$!', $tokens);
$sect_prop_exprs = preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:[^|]+)?)*$!', $tokens); $sect_prop_exprs = preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:[^|]+)?)*$!', $tokens);