The smarty list plug-in displays the title length and connection. now, you need to write a list plug-in the smarty plug-in to intercept the title length. PHPcode & lt ;? Phpfunctionsmarty_function_list ($ params, & amp; $ smarty) {extract ($ param smarty list ins display title length and connection
Now I am writing a website. I want to write a list plug-in the smarty plug-in. I want to extract the title length.
PHP code
PageExecute ($ SQL, $ pagesize, $ page); $ rs = $ rs-> getRows (); $ smarty-> assign ($ length, $ length ); $ smarty-> assign ($ varname, $ rs); unset ($ rs) ;}?>
The above is the plug-in code;
HTML code
{--list cate="articles" items="Title" length=4 varname="rs"--}{--foreach from=$rs item=r--}{--$r.Title--}
{--/foreach--}
The above is the template code.
Now we want to intercept the title length and connect it with the title.
$ R. Titletruncatecn: $ length: "...": true
This is not acceptable! Thank you!
------ Solution --------------------
Discussion
Where does $ length come from?
If it changes, try this.
$ R. Title | truncate: '$ length': "...": true
Specify a specific number.
$ R. Title | truncate: 30: "...": true