Smarty HTML
1.php
Include_once ("libs/smarty.class.php");
$smarty =new smarty ();
$smarty->template_dir= "Templates";
$smarty->compile_dir= "Compile";
$smarty->config_dir= "config";
$smarty->cache_dir= "Cache";
$smarty->left_delimiter= "{";
$smarty->right_delimiter= "}";
?>
2.php
Include ("smarty_include.php");
$name = "This was an apple!";
$smarty->assign ("abc", $NAME);
$smarty->display ("index.html");
?>
Index.html
{$ABC}
The $ABC in index cannot show the value of $name
2.php can be displayed in the apple!
May I ask why this is
Reply to discussion (solution)
Download the latest smarty:http://smarty.php.net/current version: 2.6.18 after extracting the Libs directory in the directory renamed to Smarty, copy to your site directory, At the same time, in the site root directory established templates and Templates_c two directories to establish test.php, the contents are as follows:
template_dir = "./templates";//Template Storage directory $smarty Compile_dir = "./templates_c"; Compile directory $smarty-left_delimiter = "{"; Left delimiter $smarty-right_delimiter = "}}"; Right delimiter $smarty-assign (' Test ', ' OK '); $smarty, display (' test.html ');?> to Templates_c permissions 755 Create a new test.html in the templates directory: {{$test}}
Test.php shows OK, but test.html is {{$test}}, no value displayed, no difference. I want to know how to display {{$test}} in the HTML file.
Confirm that the Smarty is properly configured ... I don't know what version of your smarty is.
Test.php shows OK, but test.html is {{$test}}, no value displayed, no difference. I want to know how to display {{$test}} in the HTML file.
have permission to set the cache directory
3.1.13 and 2.6.27 versions, have tried.