聪明地包括文件包含动态内容的页面


smarty include file a page with dynamic content

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

索引.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 错误"

打开网址:www.test.com/menu/index 可以获取动态内容。将列表的内容复制到"_head.tpl"而不是聪明的句子(<{include>),"www.test.com/index"显示得很好。

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

参考这里 : http://www.smarty.net/forums/viewtopic.php?p=78900