Home  >  Article  >  Backend Development  >  html公共模板,数组方式传值,数据调用方式?

html公共模板,数组方式传值,数据调用方式?

WBOY
WBOYOriginal
2016-06-06 20:41:531152browse

有如下一段html放在公共模板中

<code><input type="text" name="$text_name" value="$data[$test_name]">
</code>

然后在通过如下方式调用复用

<code><include file="xxx.html $text_name=" info1></include>
<include file="xxx.html $text_name=" info2></include>
</code>

这样子在提交表单数据跟回显的时候是可以正常调用的
但是,我想要用数组方式传递数据,用如下方式调用

<code><include file="xxx.html $text_name=" info></include>
<include file="xxx.html $text_name=" info></include>
</code>

这样子在数据回显的时候就不懂得该怎么处理数据访问方式
想看看大家是怎么处理的[或者是其他更好的模板分离方式],谢谢

回复内容:

有如下一段html放在公共模板中

<code><input type="text" name="$text_name" value="$data[$test_name]">
</code>

然后在通过如下方式调用复用

<code><include file="xxx.html $text_name=" info1></include>
<include file="xxx.html $text_name=" info2></include>
</code>

这样子在提交表单数据跟回显的时候是可以正常调用的
但是,我想要用数组方式传递数据,用如下方式调用

<code><include file="xxx.html $text_name=" info></include>
<include file="xxx.html $text_name=" info></include>
</code>

这样子在数据回显的时候就不懂得该怎么处理数据访问方式
想看看大家是怎么处理的[或者是其他更好的模板分离方式],谢谢

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