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

Smarty to realize alternate display of table colors_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:43:36987browse

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:
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