smarty怎么取得tpl中的所有变量组成数组
3个回答
2013-08-03
展开全部
search.php为程序文件,templates/search.tpl为模板文件
在模板中用了iframe。图片、表格什么的太多,不贴了。关键的代码如下
<script type= "text/javascript ">
function search_data()
{
var sId=document.getElementById( "s_search ").value;
top.frames[ "hiddenFrame "].location= "search_result.php?id= "+sId;
}
function display_result(sText)
{
var div_search_info = document.getElementById( "div_search_info ");
div_search_info.innerHTML = sText;
}
</script>
<input type= "text " name= "s_search " id= "s_search " />  
<input type= "button " name= "to_search " id= "to_search " value= "提交 " onclick= "search_data() " /> <br>
<div id= "div_search_info "> </div>
<iframe src= "about:blank " name= "hiddenFrame " width= "0 " height= "0 " frameborder= "0 "> </iframe>
search_result.php主要的代码如下
<head>
<?php
//查询数据库,赋值$sInfo。这一段没有错误
?>
<script type= "text/javascript ">
window.onload = function ()
{
var divInfoToReturn = document.getElementById( "divInfoToReturn ");
parent.display_result(divInfoToReturn.innerHTML);
};
</script>
</head>
<body>
<div id= "divInfoToReturn "> <?php echo $sInfo; ?> </div>
</body>
点击查询,什么东西也没显示。如果把tpl改成html,就能正常显示了
在模板中用了iframe。图片、表格什么的太多,不贴了。关键的代码如下
<script type= "text/javascript ">
function search_data()
{
var sId=document.getElementById( "s_search ").value;
top.frames[ "hiddenFrame "].location= "search_result.php?id= "+sId;
}
function display_result(sText)
{
var div_search_info = document.getElementById( "div_search_info ");
div_search_info.innerHTML = sText;
}
</script>
<input type= "text " name= "s_search " id= "s_search " />  
<input type= "button " name= "to_search " id= "to_search " value= "提交 " onclick= "search_data() " /> <br>
<div id= "div_search_info "> </div>
<iframe src= "about:blank " name= "hiddenFrame " width= "0 " height= "0 " frameborder= "0 "> </iframe>
search_result.php主要的代码如下
<head>
<?php
//查询数据库,赋值$sInfo。这一段没有错误
?>
<script type= "text/javascript ">
window.onload = function ()
{
var divInfoToReturn = document.getElementById( "divInfoToReturn ");
parent.display_result(divInfoToReturn.innerHTML);
};
</script>
</head>
<body>
<div id= "divInfoToReturn "> <?php echo $sInfo; ?> </div>
</body>
点击查询,什么东西也没显示。如果把tpl改成html,就能正常显示了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-03
展开全部
search.tpl.html!或者你把smarty配置改一下!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-03
展开全部
templates/search.tpl为模板文件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询