Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the output of smarty simple template variables

Shulou Source: shulou.com Published: 2022-06-03 09:03:25 11月15日 Update

This article introduces the relevant knowledge of "how to realize smarty simple template variable output". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

These are as follows:

The config.inc.php configuration file is as follows:

include_once ('smarty/Smarty.class.php ');$smarty=new Smarty();$smarty->config_dir="smarty/Config_File.class.php";$smarty->caching=false; //Enable caching $smarty->template_dir="./ templates"; //template directory $smarty->compile_dir="./ templates_c"; //compile directory $smarty->cache_dir="./ smarty_cache"; //cache directory $smarty->left_delimiter="";

The index.php file is as follows:

include('./ config.inc.php');$title="php test title";$content="smarty exercise!" ";$newstext[]=array ("name"=>"php program test","date"=>"2015-08-01");$newstext[]=array ("name"=>"php video tutorial","date"=>"2015-08-02");$newstext[]=array ("name"=>"smarty learning","date"=>"2015-08-03");$row=array ("Title,""Name,""Age");$smarty->assign ("title",$title);$smarty->assign ("row",$row);//an array passes multiple values $smarty->assign("shownewstext",$newstext);//a two-dimensional array passes multiple values $smarty->assign("content",$content);$smarty->display ('index.htm ');

The results are as follows:

Test Array: Title| name|- -------------------------- Circular news content for: php program test- 2015-08-01php video tutorial- 2015-08-02smarty learning- 2015-08-03"how to achieve smarty simple template variable output" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Tags: Test content template output array title directory learning variables multiple name age tutorials files more knowledge programs cache video utility Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Linux MariaDB MySQL Shulou Information