Custom min version smarty template engine MinSmarty.class.php file and usage, Smarty template engine
This example describes the custom min version of the Smarty template engine MinSmarty.class.php file. Share to everyone for your reference, as follows:
First, the advantages of Smarty
Smarty is a template engine writte
All templates Support Parameter replacement during template instantiation to replace key parameters, such as class names and namespaces. When you click OK in the "New Project" and "Add new project" dialog boxes, these parameters will be replaced by the template wizard running in the background.Declare and enable template parameters
Behavior mode:
Behavior patterns involvedAlgorithmAnd the assignment of responsibilities between objects. Shift your attention from the control flow to the contact information between objects.
Behavior patterns include:Behavior modeAndBehavior Object Mode.Behavior mode usageInheritance MechanismDistribute actions between classes;Behavior Object Mode usageObject combinationInstead of inheritance.
Template Method
Compile your own template parser in javascript, and write a template in javascriptCompile your own template parser
Recently I have been studying templates such as artTemplate, ejs, and baaiduTemplate. Therefore, I wrote a simple template parser on the rise.
What functions does a basic
[TOC]TemplateWhen we implement a swap function, we can write it as follows.void Swap(int x, int y){ int tmp = x; x = y; y = tmp;}Only two integers can be exchanged here, and when we need to implement a two-character exchange, we need to re-write a function, but two parts of the code have a lot of the same parts, which is not very troublesome. If we just need to write a code to achieve different types of exchange, is not very good. Yes, this compiler has been designed for us, which is ca
Two simple templates:
Copy Code code as follows:
Copy Code code as follows:
Http_template_it class library must be installed first
Copy Code code as follows:
Require_once "html/template/it.php";
Creates a new Html_template_it object, where the parameter is the path of the template file
$template = new
void smarty_function_name(array $params, object $smarty)
All attributes passed to template functions from the template are contained in$ ParamsAs an associative array. Either access those values directly, e.g.$ Params ['start']Or useExtract ($ Params)To import them into the symbol table.
All attributes passed by the template to the
NodeJS creates the basic application and application template engine, and nodejs creates the template engine.
The purpose of this project is to build a NodeJS server with the most basic functions that can be implemented, reflecting the node. js workflow and the basic framework for development.Requirement: nodejs and express have been installed.1. Build a basic NodeJS server (express and route)
Var express =
Template Method template method mode
1. Definition
Template Method mode defines an operation inAlgorithmAnd delay some steps to the subclass. The template method allows the subclass to redefine certain steps of an algorithm without changing the structure of an algorithm.
2. Description
What is "
The quick start of Smarty Templates has already seen a variety of template classes in the PHP world, but Smarty is still in the leading position in terms of functionality and speed, because Smarty is relatively powerful, therefore, it is a little more complex to use than some other template classes. Now you can get started in 30 minutes.
1. Installation
First open the webpage http://smarty.php.net/downloa
The allocation data type of the smarty template engine, and the smarty template data type. The allocation data type of the smarty template engine. The data type of the smarty template is described in this document. Share it with you for your reference. For details, see the distribution data type of the smarty
// The C ++ template is parameterized.ProgramDesign method, which is a completely common method to design functions or classes// You do not need to specify the types of each object to be used in advance. The types of these template calculation objects are not actual.// Data type, but a parameterized type (also known as a type parameter ).// A class with a type parameter is called a class
Introduction of Template Method pattern (Brief Introduction)
Template method Patterns (Template methods pattern) that define an algorithm skeleton in an operation and delay some steps into subclasses. Template methods allow subclasses to redefine some specific steps of an algorithm without altering the structure of an
function template customization can solve specific template parameters and require specific function methods to achieve them.
Note that function template customization is the instantiation of the template, not the overload of the template;
When there are non-
Everyone should know that the rational use of cache can effectively reduce the pressure on the website server. as a very good php template engine, phpSmarty provides us with simple and diverse cache operations, next let's take a look at some tips on smarty cache operations. here we will analyze how to enable and use the smarty cache, how to clear the smarty cache, and the smarty global cache and partial cache, the local cache has three caching mechani
Tools/Materials
VS2013 (VS2010 and other versions also apply, both need to install the visual Studio SDK)
Method/Step
Create a model project first.Create a new WinForm application project and modify the form name to MainForm.
Open the Export Template Wizard interface from file to export template.
Template type Select the project
In the previous article, we have learned how to create a JSP template containing the "head" area and "foot" area. Now we will expand this template, add multiple editable page elements.First, add the "Use this template to generate a page. The effect is as follows: the "body" element is now an area that can be directly edited. An "edit" button is displayed on the r
"Design pattern Refinement" Learning notes (14) ------Template method (Template method) mode
GOF : defines the skeleton of an algorithm in an operation, and delays some steps into subclasses. Template method enables subclasses to redefine certain steps of the algorithm without altering the structure of an algorithm.
Inheritance is one of the three character
This article mainly introduces how to use the configuration file of the PHP template engine Smarty in the template variables, and analyzes the procedure and related skills of using the configuration file variables in the form of instances, for more information about how to use the configuration file of the PHP template engine Smarty in
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.