How can I solve this array in smarty?

Source: Internet
Author: User
If you understand this array in smarty $ arr | api: 'cases': 'getinfolist': & quot; wherepass = 1 ^ ORDERBYtopflagDESC, submit_dateDESC ^ 0 ^ 8 ^ id, title, thumbnail, bedeck ^ 0 & quot; in BIweb, how can this array in smarty be understood?
$ Arr | api: 'cases': 'getinfolist': "where pass = 1 ^ order by topflag DESC, submit_date DESC ^ 0 ^ 8 ^ id, title, thumbnail, bedeck ^ 0"

How does one understand this array in BIweb ??

------ Solution --------------------
Find an example in the lz Manual: {$ articleTitle | truncate: 30: "": true}, which means to pass the $ articleTitle variable to the truncate method, with three parameters 30, "", true, and then return the truncated result.
If you can understand the above example, lz should be clear that the api is a user-defined function, followed by three parameters separated ':'
'|' Is similar to the pipeline function. $ arr is passed to the api function and the processed result is returned.
Refer to the following article:
Http://www.189works.com/article-39919-1.html
------ Solution --------------------
The variable regulator is used for variables, user-defined functions, and strings. Use the '|' symbol and the regulator name to apply the regulator. The behavior of a variable regulator is determined by the value of the parameter. Parameters are separated by the ':' symbol.

The custom functions in the Smarty template engine are stored in the plug-in Directory (plugins). the built-in functions are written in the syntax of smarty. User-defined functions can be modified at will, and can be added at will. built-in functions are not.

We can customize the function file in the plugins directory, but we must strictly follow the naming rules of the smarty function, so that when we call the custom function, smarty can be found under the plugins.

Next, we will define two user-defined functions:
The stredit function is used to convert the case sensitivity of strings.
The jiequ function is used to intercept strings.

Naming rules:
The variable regulator file name must start with modifier, followed by a custom function name, such as modifier. stredit. php, modifier. jiequ. php
The name of the variable regulator function must start with smarty_modifier _ and be connected to the custom function name, for example, smarty_modifier_stredit () and smarty_modifier_jiequ ()

Custom string operation functions

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.