繁体   English   中英

巧妙地将文件包含在动态内容页面中

[英]smarty include file a page with dynamic content

index.php包含一些模块页面_head.tpl,_foot.tpl

index.php:

<{include file="_head.tpl"}>
....
<php?
  ....
?>
<{include file="_footer.tpl"}>

_head.tpl

<html>
<head></head>
<body>
<{include file="$baseUrl/menu/index"}>
.....

打开网址时:www.test.com/index显示“ http 500错误”

打开URL: www.test.com/menu/index可以获取动态内容。 将列表的内容复制到“ _head.tpl”而不是漂亮的句子( <{include file =“ $ baseUrl / menu / index”}> ),“ www.test.com/index ”显示得很好。

您不能像这样直接指定。 您必须使用php file_get_contents或Curl获取内容。

请参阅此处: http : //www.smarty.net/forums/viewtopic.php?p=78900

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM