pick up an article
10.Html_options Print a set of option for select elements
{html_options values= $cust _ids selected= $customer _id output= $cust _names}
Text
Values: An array of value
Output: An array of text
Selected: The value of the
PHP smarty Template conditional selection structure If-elseif-else,{if} must be paired with {/if}, but you can also use {else} and {ElseIf} clauses, and the following modifiers can be used in {if}:
If instance
{if} instance:
{if $name eq ' Fred '}
Smarty: Template TechnologyRealization function: Separation before and after.Principle: Mainly through the Smarty core class implementation, call the display method, the template file read, replace with regular, replace save to temporary file, the
Php's smarty template engine php is an embedded HTML scripting language. in order to separate HTML and php code, the so-called logic layer and presentation layer, this is the purpose of the template engine. To achieve this purpose, the template
{Capture name= "test"}
{/capture}
{$smarty. Capture.test}
Copy CodeDescription: The contents of {Capture Name= "test"} and {/capture} are stored in the variable $test, which is specified by the Name
PHP designers, who are just beginning to touch the template engine, will find it hard to hear Smarty. In fact, the author is no exception, touch all dare not touch a bit. But later in the anatomy of XOOPS's program architecture, it is not difficult
The following are examples of accessing page request variables such as get,post,cookies,server,enviroment and session variables. For example {$smarty. server.server_name} Gets the server variable, {$smarty. Env.path} Gets the system environment
Configuration of the 1,smarty cache:
$smarty->cache-dir= "directory name"; Create a cache directory name
$smarty->caching=true; Cache is turned on, false when caching is not valid
$smarty->cache_lifetime=60; Cache time in seconds
Use and purge of
EQ equals,
NE, neq not Equal,
GT greater Than,
LT is less than
GTE, GE greater than equals,
LTE, le less than equals,
Not non, mod modulo.
Is (not) div by can be divisible by a number,
Is (not) even is an even number,
$a is [not] even by $b i.e. ($a/
For more information about smarty, see: http://www.php100.com/manual/smarty/index.html
Index. php
Require ('.. /libs/smarty. class. PHP '); $ smarty = new smarty; // Add a custom regulator $ smarty-> registerplugin ("modifier", "E",
In php, smarty implements a multi-template website, and phpsmarty implements a template.
This article describes how to implement a multi-template website using smarty in php. Share it with you for your reference. The specific implementation method
1. Use gettext. Because Smarty has the corresponding gettext plug-in, you can directly use this plug-in.
The procedure is as follows:
1.1 Add the following code to a public include file:
// $ Domain_info ['lang '] indicates the language
Initial use and Considerations for PHP Smarty Framework
1. What is a template engineTwo parts more concerned1.1 is GUI (view, interface)--html CSS javascripte1.2 is the business logic (PHP code)--php MYSQLThe template engine is a project developed
PHP Smarty Cache usage
First, use the cache?To turn on the Smarty cache, simply set caching to True and specify Cache_dir.Use Cache_lefetime to specify the cache lifetime in secondsTo generate multiple different caches for the same page,
PHP smarty Template engine configuration and testing
Smarty Introduction
Smarty is a php template used to write a template engine, it provides a separation of logic and external content, in brief, the purpose is to use a PHP programmer with the Art
Php+smarty why under IE Normal, under the Firefox +IE9 all is the source code??? Tokyu
Php+smarty Why in IE6, 7 under Normal, in Firefox +ie9 under all source code??? Tokyu
------Solution--------------------
This post was last edited by xuzuning on 2
An example of this article describes the implementation of importing FCKeditor into Php+smarty. Share to everyone for your reference. The specific analysis is as follows:
When extracting fckeditor, it is used as follows, PHP uses $_post[' p_info '
Smarty is a PHP template engine developed by Monte OHRT and Andrei zmievski using the PHP language. It has become a very popular template engine since its development, smarty provides an easy-to-manage and use method to share PHP code from the hmtl
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.