Examples of post usage in smarty, examples of smartypost
The example in this article describes the usage of post in smarty. Share it with everyone for your reference. The specific analysis is as follows:
After knowing how smarty works, I want to write a post implementation process. The following is the code to implement post. It is similar to writing PHP code alone, except that there are more display files
Configuration file: conf.php
Copy code The code is as follows:
@header("Content-type: text/html; charset=UTF-8");
require '../libs/Smarty.class.php';
$my=new Smarty;
$my->template_dir ='templates/';
$my->compile_dir ='templates_c/';
$my->config_dir ='configs/';
$my->cache_dir ='cache/';
?>
index.php
Copy code The code is as follows:
include 'conf.php';
$my->assign('content','welcome to arrival');
$my->assign('mylife',array("life","eating","dream","cool breeze","revenge","fuck someone","fuck you die"));
$my->display('kk.html');
?>
kk.html under template [display file of index.php]
Copy code The code is as follows:
Untitled Document
{$content}
{section name=truelife loop=$mylife}
{$mylife[truelife]}
{/section}
{html_select_time use_24_hours=true}
submit.php
Copy code The code is as follows:
include 'conf.php';
$kk=$_POST['conteng'];
$ct=$_POST['ct'];
$sm=new Smarty();
$sm->assign('content',$kk);
$k=explode("rn",$ct); //Separate characters into arrays
$sm->assign('ml',$k);
$sm->display('m.tpl');
?>
m.tpl file under template [display file of submit.php]
Copy code The code is as follows:
{$content}
{section name=kk loop=$ml}
{$ml[kk]}
{/section}
I hope this article will be helpful to everyone’s smarty programming design.
http://www.bkjia.com/PHPjc/919261.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/919261.htmlTechArticleExamples of post usage in smarty, smartypost examples This article describes the usage of post in smarty. Share it with everyone for your reference. The specific analysis is as follows: After knowing the operating principle of smarty,...