PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 1ms

/framework/vendor/smarty3/lib/SMARTY2_BC_NOTES

http://zoop.googlecode.com/
#! | 82 lines | 64 code | 18 blank | 0 comment | 0 complexity | 411478aa2fdb2f255d8801f0feb417f8 MD5 | raw file
 1= Known incompatibilities with Smarty 2 =
 2
 3== Syntax ==
 4
 5Smarty 3 API has a new syntax. Much of the Smarty 2 syntax is supported but
 6deprecated. See the README that comes with Smarty 3 for more information.
 7
 8== PHP Version ==
 9Smarty 3 is PHP 5 only. It will not work with PHP 4.
10
11== {php} Tag ==
12The {php} tag is disabled by default. The use of {php} tags is
13deprecated. It can be enabled with $smarty->allow_php_tag=true.
14
15But if you scatter PHP code which belongs together into several
16{php} tags it may not work any longer.
17
18== Delimiters and whitespace ==
19Delimiters surrounded by whitespace are no longer treated as Smarty tags.
20Therefore, { foo } will not compile as a tag, you must use {foo}. This change
21Makes Javascript/CSS easier to work with, eliminating the need for {literal}.
22This can be disabled by setting $smarty->auto_literal = false;
23
24== Unquoted Strings ==
25Smarty 2 was a bit more forgiving (and ambiguous) when it comes to unquoted strings 
26in parameters. Smarty3 is more restrictive. You can still pass strings without quotes 
27so long as they contain no special characters. (anything outside of A-Za-z0-9_) 
28
29For example filename strings must be quoted
30<source lang="smarty">
31{include file='path/foo.tpl'}
32</source>
33
34== Extending the Smarty class ==
35Smarty 3 makes use of the __construct method for initialization. If you are extending 
36the Smarty class, its constructor is not called implicitly if the your child class defines 
37its own constructor. In order to run Smarty's constructor, a call to parent::__construct() 
38within your child constructor is required. 
39
40<source lang="php">
41class MySmarty extends Smarty {
42   function __construct() {
43       parent::__construct();
44    
45       // your initialization code goes here
46
47   }
48}
49</source>
50
51== Autoloader ==
52Smarty 3 does register its own autoloader with spl_autoload_register. If your code has 
53an existing __autoload function then this function must be explicitly registered on 
54the __autoload stack. See http://us3.php.net/manual/en/function.spl-autoload-register.php 
55for further details.
56
57== Plugin Filenames ==
58Smarty 3 optionally supports the PHP spl_autoloader. The autoloader requires filenames 
59to be lower case. Because of this, Smarty plugin file names must also be lowercase. 
60In Smarty 2, mixed case file names did work.
61
62== Scope of Special Smarty Variables ==
63In Smarty 2 the special Smarty variables $smarty.section... and $smarty.foreach... 
64had global scope. If you had loops with the same name in subtemplates you could accidentally 
65overwrite values of parent template.
66
67In Smarty 3 these special Smarty variable have only local scope in the template which 
68is defining the loop. If you need their value in a subtemplate you have to pass them 
69as parameter.
70<source lang="smarty">
71{include file='path/foo.tpl' index=$smarty.section.foo.index}
72</source>
73
74== SMARTY_RESOURCE_CHAR_SET ==
75Smarty 3 sets the constant SMARTY_RESOURCE_CHAR_SET to utf-8 as default template charset. 
76This is now used also on modifiers like escape as default charset. If your templates use 
77other charsets make sure that you define the constant accordingly. Otherwise you may not 
78get any output.
79
80== newline at {if} tags ==
81A \n was added to the compiled code of the {if},{else},{elseif},{/if} tags to get output of newlines as expected by the template source. 
82If one of the {if} tags is at the line end you will now get a newline in the HTML output.