<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>自定义标签解析</title> <tag:define namespace='core,ui' /> </head> <body> <ui:tabPane tabs='3' default='0' style="width:400px;height:300px;"> <core:foreach var='book' vars='books'> <ui:tabWindow title='book.name' content='book.summary'></ui:tabWindow> </core:foreach> </ui:tabPane> </body> </html>
?
想将这部分的自定义标签解析成
?
<ui:tabPane tabs='3' default='0' style="width:400px;height:300px;"> <core:foreach var='book' vars='books'> <ui:tabWindow title='book.name' content='book.summary'></ui:tabWindow> </core:foreach> </ui:tabPane>
?
?
如下 PHP代码 , 不知道能否实现呢 .... 继续想
<?php echo webcontrol('tabPane')->doStartTag(); ?> <?php foreach ($books as $book) :?> <?php echo webcontrol('tabWindow',"tabwindow-book-{$book['id']}",$book['name'],$book['summary'])->output(); ?> <?php endforeach?> <?php echo webcontrol('tabPane')->doEndTag();?>