CI framework integrates Smarty method analysis, and ci framework integrates smarty
This article describes how to integrate Smarty with the CI framework. We will share this with you for your reference. The details are as follows:
Because the built-in template function of CI is not very convenient, it is widely used to integrate
Smarty template learning notes: Smarty introduction. 1. introduction Smarty is a PHP template engine written using PHP. it is one of the most famous PHP template engines in the industry. It separates the logic code from external content and provides a brief introduction
Smarty is a PHP template engine written using PH
Common Simple Application Analysis of Smarty templates and smarty Application Analysis
This document analyzes common simple applications of Smarty templates. We will share this with you for your reference. The details are as follows:
First, you must include the smarty class:
include_once '../libs/Smarty.class.php';
The
Smarty learning notes: common code snippet usage summary, smarty learning notes
This example describes common code segments of smarty. We will share this with you for your reference. The details are as follows:
1,
Description: generate a drop-down menu. Values = an array. The array element is the list value selected = A value. This is the default column.
Table v
Smarty variable usage explained, Smarty variable explanation
Examples of this article describe the use of smarty variables. Share to everyone for your reference, as follows:
1. Variables assigned from PHP
The variable that is assigned from PHP is called with a "$" symbol before it. (Same as PHP)
This is also true for variables that are assigned by the Assign fun
There are some reserved variables in Smarty, which can be directly used without being assigned by a PHP script, that is, $ _ tpl- gt; assign ( amp; #39; var amp; #39;, amp; #39; value amp; #39. 1. variable {$ smarty. get. user} $ _...
In Smarty, there are some reserved variables that can be directly used without being assigned by a PHP script, that is, $ _ tp
don't want PHP programmers to design HTML pages at all, but that's inevitable. For example, if the artist wants to alternate a different background color between dynamic blocks, he may have to agree with the programmer beforehand. Similarly, artists should have their own configuration files for page design, which can also be dragged through variables into the template.
The birth of Smarty
As early as the
What should I do if I want to generate a random number in the smarty template? Generate in the PHP file and assign values to the template. This is absolutely feasible, but it is too complicated. The following tips will be used to generate random numbers directly in the smarty template. Now, assume that a random number between and needs to be generated in the smarty
In order to separate the business logic of the program from the content presentation page and improve the development speed, php introduces the template engine concept. The most popular php template engine is smarty, smarty is recognized by PHP Web developers for its powerful functions and fast speed. This article will record how the smarty template engine works.
function is rerun each time the template is invoked.
How to use:
Note that the function name here must begin with insert, and the name in the template corresponds to it.
index.php
index.php
The code is as follows
Copy Code
Define a time to test the difference between inserts and ordinary assign$date = Date ("y-m-d h:i:s");$smarty->assign ("date", $date);Insertfunction Insert_get_current_time ($date) {Return Date ("y
The smarty template engine obtains data from the configuration file. The smarty template engine obtains data from the configuration file. This document describes how the smarty template engine obtains data from the configuration file. For your reference, the smarty template engine obtains data from the configuration fi
Smarty methods for customizing functions in the template engine, Smarty template engine functions
The example of this paper describes the Smarty custom function method, share to everyone for your reference. Specific as follows:
Purpose of this example: Output times con content (output 4 times Hello World)
File 1:Copy the Code code as follows: Create a
In Smarty, there are some reserved variables that can be directly used without being assigned by a PHP script, that is, $ _ tpl-> assign ('var', 'value') is not used ') distribute.
1. variables used to access the page request in the template
{$ Smarty. get. user }== _ GET ['user']
{$ Smarty. post. user }== _ POST ['user']
{$
Smarty simple entry instance, smarty instance. Smarty simple Getting started instance. smarty instance this article uses a simple instance to analyze the usage of smarty. Share it with you for your reference. The specific analysis is as follows:
In Smarty, there are reserved variables that are not required to be allocated by the PHP script and can be used directly, i.e. without using $_tpl->assign (' var ', ' value ') to allocate.
1. Accessing the page request variables in the template
{$smarty. get.user} = = $_get[' user ')
{$smarty. post.user} = = $_post[' user ')
{$
Distribution Data Type of the smarty template engine, and smarty template Data Type
This document describes how to use the smarty template engine to allocate data types. Share it with you for your reference. The specific analysis is as follows:
1. Allocate basic data
// Allocate basic data $ smarty-> assign ("str", "he
guest_template_dir and admin_template_dir. if not specified, the above file name will be used.
(2) usage:
Design template:
1 Template variable: {$ variable name}, for example, {$ color}, {$ type}
Test_color.tpl
{$ Name}
Test_url.tpl
{$ Title}
2. you can also use a template array.
Test_array.tpl
{People. name}
{People. sex}
{People. money}
3. list of
Smarty simple pagination Implementation method, Smarty paging implementation
The example of this paper describes the implementation of Smarty simple paging, shared for everyone to reference. The implementation method is as follows:
The following is the template of the Smarty code, with
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.