mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
added RELEASE_NOTES file to cvs
This commit is contained in:
42
FAQ
42
FAQ
@@ -25,17 +25,17 @@ A: Smarty reads the template files and creates PHP scripts from them. Once
|
|||||||
in Smarty for increased performance.)
|
in Smarty for increased performance.)
|
||||||
|
|
||||||
Q: Why can't I just use APC <http://apc.communityconnect.com/> (or Zend Cache)?
|
Q: Why can't I just use APC <http://apc.communityconnect.com/> (or Zend Cache)?
|
||||||
A: Smarty and these cache solutions have nothing in common. What APC does is
|
A: You certainly can. Smarty's cache and these cache solutions have nothing in
|
||||||
caches compiled bytecode of your PHP scripts in shared memory or in a file.
|
common. What APC does is caches compiled bytecode of your PHP scripts in
|
||||||
This speeds up server response and saves the compilation step. Smarty
|
shared memory or in a file. This speeds up server response and saves the
|
||||||
creates PHP scripts (which APC will cache nicely) and also has it's own
|
compilation step. Smarty creates PHP scripts (which APC will cache nicely)
|
||||||
internal caching mechanism for the output of the template contents. For
|
and also has it's own internal caching mechanism for the output of the
|
||||||
example, if you have a template that requires several database queries,
|
template contents. For example, if you have a template that requires several
|
||||||
Smarty can cache this output, saving the need to call the database every
|
database queries, Smarty can cache this output, saving the need to call the
|
||||||
time. APC cannot help you here. Smarty and APC (or Zend Cache) actually
|
database every time. APC cannot help you here. Smarty and APC (or Zend
|
||||||
complement each other nicely. If performance is of the utmost importance, we
|
Cache) actually complement each other nicely. If performance is of the
|
||||||
would recommend using one of these with any PHP application, using Smarty or
|
utmost importance, we would recommend using one of these with any PHP
|
||||||
not.
|
application, using Smarty or not.
|
||||||
|
|
||||||
Q: Is Smarty faster than <insert other PHP template engine>?
|
Q: Is Smarty faster than <insert other PHP template engine>?
|
||||||
A: It could be. One of the strengths of Smarty is that it does not need to
|
A: It could be. One of the strengths of Smarty is that it does not need to
|
||||||
@@ -50,11 +50,12 @@ A: It could be. One of the strengths of Smarty is that it does not need to
|
|||||||
templates.
|
templates.
|
||||||
|
|
||||||
Q: How can I be sure to get the best performance from Smarty?
|
Q: How can I be sure to get the best performance from Smarty?
|
||||||
A Be sure you set $compile_check=false once your templates are initially
|
A: Be sure you set $compile_check=false once your templates are initially
|
||||||
compiled. This will skip the unneeded step of traversing all of your template files on each hit. If you have complex pages that don't change too often,
|
compiled. This will skip the unneeded step of testing if the template has
|
||||||
turn on the caching engine and adjust your application so it doesn't do
|
changed since it was last compiled. If you have complex pages that don't
|
||||||
unnecessary work (like db calls) if a cached page is available. See the
|
change too often, turn on the caching engine and adjust your application so
|
||||||
documentation for examples.
|
it doesn't do unnecessary work (like db calls) if a cached page is
|
||||||
|
available. See the documentation for examples.
|
||||||
|
|
||||||
Q: Can I use Macromedia's Dreamweaver to edit my templates?
|
Q: Can I use Macromedia's Dreamweaver to edit my templates?
|
||||||
A: Certainly. You might want to change your tag delimiters from {} to something
|
A: Certainly. You might want to change your tag delimiters from {} to something
|
||||||
@@ -115,8 +116,15 @@ Q: I'm running Windows 2000 and I get blank content. My compiled PHP files are
|
|||||||
A: There seems to be a problem with some W2k machines and exclusive file
|
A: There seems to be a problem with some W2k machines and exclusive file
|
||||||
locking. Comment out the flock() call in _write_file to get around this,
|
locking. Comment out the flock() call in _write_file to get around this,
|
||||||
although be aware this could possibly cause a problem with simultaneous
|
although be aware this could possibly cause a problem with simultaneous
|
||||||
writes to a file, especially with caching turned on.
|
writes to a file, especially with caching turned on. NOTE: As of Smarty
|
||||||
|
1.4.0, a workaround was put in place that should solve this.
|
||||||
|
|
||||||
Q: The template goes into an infinite loop when I include included templates
|
Q: The template goes into an infinite loop when I include included templates
|
||||||
that pass local variables
|
that pass local variables
|
||||||
A: This was fixed in 1.3.2 (new global attribute)
|
A: This was fixed in 1.3.2 (new global attribute)
|
||||||
|
|
||||||
|
Q: How can I tell what compiled template file corresponds to to which source
|
||||||
|
file? (Smarty 1.4.0 and later have encoded compiled filenames)
|
||||||
|
A: Compiled template files have headers that tell which source file was used to
|
||||||
|
compile it. cd into the compile_dir and type "head -2 *" to see the first
|
||||||
|
two lines of each compiled file.
|
||||||
|
18
QUICKSTART
18
QUICKSTART
@@ -7,17 +7,17 @@ will work for you.
|
|||||||
|
|
||||||
We make a few assumptions here, such as you already have PHP installed on your
|
We make a few assumptions here, such as you already have PHP installed on your
|
||||||
web server, you know the basics of unix file permissions, the basics of PHP and
|
web server, you know the basics of unix file permissions, the basics of PHP and
|
||||||
how it works, etc. If you are using Smarty in a non-unix environment, you should
|
how it works, etc. If you are using Smarty in a non-unix environment, you
|
||||||
understand the difference in your OS regarding file permissions.
|
should understand the difference in your OS regarding file permissions.
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Unpack the Smarty tarball. You will see fou: class files: Smarty.class.php,
|
Unpack the Smarty tarball. You will see four class files: Smarty.class.php,
|
||||||
Smarty.addons.php, Smarty_Compiler.class.php and Config_File.class.php. You will
|
Smarty.addons.php, Smarty_Compiler.class.php and Config_File.class.php. You
|
||||||
need to have all three of these files somewhere in your PHP include path, so when
|
will need to have all three of these files somewhere in your PHP include path,
|
||||||
you call require("Smarty.class.php") from within your application, it can find the
|
so when you call require("Smarty.class.php") from within your application, it
|
||||||
class.
|
can find the class.
|
||||||
|
|
||||||
Smarty uses the PEAR libraries for some of its error handling routines. PEAR
|
Smarty uses the PEAR libraries for some of its error handling routines. PEAR
|
||||||
libraries come with the distribution of PHP. Be sure that the path to these
|
libraries come with the distribution of PHP. Be sure that the path to these
|
||||||
@@ -99,8 +99,8 @@ script which you can take a look at in the templates_c directory. Smarty will
|
|||||||
continue to use this compiled script until the index.tpl file is changed, then
|
continue to use this compiled script until the index.tpl file is changed, then
|
||||||
it will automatically recompile. What this means for you: forget about the
|
it will automatically recompile. What this means for you: forget about the
|
||||||
templates_c directory. Out of sight, out of mind. You don't need to worry about
|
templates_c directory. Out of sight, out of mind. You don't need to worry about
|
||||||
it, Smarty takes care of this technical stuff. Out of curiosity, you can see how
|
it, Smarty takes care of this technical stuff. Out of curiosity, you can see
|
||||||
your templates look as compiled php scripts, but please don't touch them!
|
how your templates look as compiled php scripts, but please don't edit them!
|
||||||
|
|
||||||
Now that we have Smarty functioning properly, let's get into the guts of Smarty
|
Now that we have Smarty functioning properly, let's get into the guts of Smarty
|
||||||
and learn what thing is all about. I'll try to briefly show examples to cover
|
and learn what thing is all about. I'll try to briefly show examples to cover
|
||||||
|
35
RELEASE_NOTES
Normal file
35
RELEASE_NOTES
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
1.4.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
The most significant change to Smarty 1.4.0 is the parse engine. Instead of
|
||||||
|
compiling all the templates up front, it now compiles them at runtime. This has
|
||||||
|
several advantages. First off, there is no longer a need to have a single
|
||||||
|
template directory. You can now have arbitrary template sources, such as
|
||||||
|
multiple directories or even database calls. This also speeds the performance
|
||||||
|
of Smarty when $compile_check is enabled, since it is only checking the
|
||||||
|
template that is being executed instead of everything found in the template
|
||||||
|
directory. The $tpl_file_ext variable was removed since this is no longer
|
||||||
|
needed, so templates can be named anything you like with any extension. Smarty
|
||||||
|
makes use of the PEAR database abstraction class for obtaining templates from
|
||||||
|
databases. Now aren't you glad we require PEAR :-)
|
||||||
|
|
||||||
|
We also added a workaround for LOCK_EX on windows systems, and change a couple
|
||||||
|
of file permissions for better security on public servers. Thanks goes to
|
||||||
|
Fernando Nunes for his code contributions.
|
||||||
|
|
||||||
|
date_format, html_select_date and html_select_time used to require a unix
|
||||||
|
timestamp as the format of the date passed into the template. Smarty is now a
|
||||||
|
bit smarter at this. It will take a unix timestamp, a mysql timestamp, or any
|
||||||
|
date string that is parsable by strtotime, such as 10/01/2001 or 2001-10-01,
|
||||||
|
etc. Just give it a try and see what works.
|
||||||
|
|
||||||
|
When upgrading to 1.4.0, you will want to first clear out all your files in the
|
||||||
|
$compile_dir, since it now uses a new format. Since templates can come from any
|
||||||
|
source, the compiled versions have encoded names. Each file has a comment at
|
||||||
|
the top that states which resource was used as the source file. In unix, "head
|
||||||
|
-2 *" shows the first two lines of each file. If you have $compile_check set to
|
||||||
|
false and the compiled template does not yet exist, it will compile it
|
||||||
|
regardless of this setting. Once it is compiled though, it will not check to
|
||||||
|
see if recompilation is necessary.
|
||||||
|
|
||||||
|
-Monte
|
Reference in New Issue
Block a user