我正在尝试使用RainTPL中的'include'标签,但它不起作用,我无法弄清楚原因。
我的服务器设置是使用apache和php的UniServer安装。我已经尝试过PHP代码来测试设置并且它有效。
<?php
include "inc/rain.tpl.class.php"; //include Rain TPL
raintpl::$tpl_dir = "layout/"; // template directory
raintpl::$cache_dir = "tmp/"; // cache directory
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Ezbuy - Compras Inteligentes - Aguardem</title>
<link rel="stylesheet" href="comingsoon.css" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
</head>
<body>
{include="layout/header"}
<section class="main">
<div class="box">
<article>
<header>
<h2>Facilidade, Preço & Segurança</h2>
</header>
<p>Cadastre-se e descubra uma forma fácil de comprar, sem necessidade de longas pesquisas pela internet.
Você pode escolher os produtos oferecidos com o menor preço.
Vendedores qualificados e método de pagamento seguro.</p>
</article>
</div>
</section>
<section class="row">
<div class="boxrow">
<article class="column" style="padding-right: 10%;">
<center><img src="interest.png" height="64px" style="padding-top: 50px;" /></center>
<header class="headercolumn">
<h2>Apenas o que interessa</h2>
</header>
<p>Find local favorites, new menu items, and global recommendations. Check the Forkly DishScore™ to see what’s good at a glance; or search every dish and detail to plan ahead.<p>
</article>
<article class="column">
<center><img src="money.png" height="64px" style="padding-top: 50px;" /></center>
<header class="headercolumn">
<h2>Pague quanto quiser</h2>
</header>
<p>Escolha o valor que deseja pagar pelo produto e aguarde uma oferta.<p>
</article>
</div>
</section>
<div class="clear"/>
<!--<footer style="height: 300px;">
<p class="copyright">© Copyright 2013 Feiler IT.</p>
</footer>-->
</body>
</html>
答案 0 :(得分:0)
只需使用{include="header"}
,因为您已经告诉Rain使用layout
文件夹作为模板目录...您目前正在尝试包含layout/layout/header.html
顺便说一句..你不应该在同一个文件中包含HTML和PHP ...你应该使用index.php文件来初始化Rain实例,然后调用draw('template')
方法并放入所有的html在文件layout/template.html