Home > Backend Development > PHP Tutorial > Smarty to realize alternate display of table colors_PHP tutorial

Smarty to realize alternate display of table colors_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:43:36
Original
1054 people have browsed it

In the past, when SMARTY was not used, JQUERY was used to alternately display table colors. But now that SMARTY is used, it is very simple to implement this style. SMARTY provides a function: cycle. The following is the example code:

The final effect is as follows:


test.php>>>

< ;?php
include_once("smarty_inc.php");
$arr=array(a,b,c,d,e,f);
$smarty->assign(arr,$arr );
$smarty->display("test.tpl");
?>


test.tpl>>>

< table width="100px">
{section name=a loop=$arr}
{cycle values="#eeeeee,#55eero"}
"> ;

{$arr[a]}


{/section}


The above is the code, it is very convenient to use.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478829.htmlTechArticleIn the past, when SMARTY was not used, to realize the alternate display of table colors, JQUERY was used to do it, but now I use With SMARTY, it is very simple to implement this style. SMARTY provides a function:...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
smarty turns on caching garbled characters
From 1970-01-01 08:00:00
0
0
0
Why does tp use smarty template? ?
From 1970-01-01 08:00:00
0
0
0
How do you use smarty to integrate laravel5?
From 1970-01-01 08:00:00
0
0
0
Two ways to install smarty
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template