Home > Backend Development > PHP Tutorial > Smarty simple entry examples, smarty examples_PHP tutorial

Smarty simple entry examples, smarty examples_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 10:12:49
Original
888 people have browsed it

Smarty simple entry examples, smarty examples

This article analyzes the usage of smarty with a simple example. Share it with everyone for your reference. The specific analysis is as follows:

After smarty creates the configuration file and displays the file, the configuration file displays the file separately, so that the art and development work can be perfectly separated

Configuration page code: index.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/';

$my->assign('content','welcome to arrival');
$my->assign('mylife',array("life","eating","dream","cool breeze"));
$my->display('kk.html'); //Display kk.html in the smarty directory
?>

kk.html
Copy code The code is as follows:




Untitled Document


{$content}
{section name=truelife loop=$mylife}
{$mylife[truelife]}
{/section}

I hope this article will be helpful to everyone’s smarty programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/919262.htmlTechArticlesmarty simple entry example, smarty example This article uses a simple example to analyze the usage of smarty. Share it with everyone for your reference. The specific analysis is as follows: smarty creates configuration files and displays...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
smarty turns on caching garbled characters
From 1970-01-01 08:00:00
0
0
0
Why does tp use smarty template? ?
From 1970-01-01 08:00:00
0
0
0
How do you use smarty to integrate laravel5?
From 1970-01-01 08:00:00
0
0
0
Two ways to install smarty
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template