View Engine Smarty Plugin

Source: Internet
Author: User

What is a smarty plugin?

Follow the original system rules, can call system functions and so on;

Strong portability, no impact on the original system;

is essentially a function;

Smarty Common plug-in types

1.functions function Plug-in

2.modifiers modifier plug-in

3.block functions block Function plugin

How do I make and use plugins? Three ways:

1. Registering a custom function with Registerplugin ()

2. Put the written plug-in into the plugins directory under the Smarty extracted Lib directory

3.PHP built-in functions that can be automatically used in templates in the form of a modifier plug-in (variable adjuster plug-in)

Functions plug-in use

1. Create a plug-in file in the plugins directory

This file is a php file with a fixed name format: function. plug-in name. php

Attention:

The name of the plug-in, which is the name of the function;

A plug-in file that contains only one function, which has the same name as the plug-in name;

Code for function writing in plug-in files:

        

When calling a function in a template, write the function name directly, and the custom function is the same

{test_area width= ' height= ' 300 '}

      

View Engine Smarty Plugin

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.