Php - шаблон Lite - PullRequest
       3

Php - шаблон Lite

0 голосов
/ 07 февраля 2012

Я действительно искал, но ничего не нашел.

Я новичок в шаблоне lite. Я добавляю свой проект template_lite и у меня есть два файла.

test.php - это:

require("../src/class.template.php");
$tpl = new Template_Lite;
$tpl->compile_dir = "compiled/";
$tpl->compile_dir = "templates/";
$tpl->assign("foo","bar");

и у меня есть простой HTML, чтобы увидеть мой код

<html>
<head>
<title>Document Title</title>
</head>
<body>
{$foo}
</body>
</html>

выводит "{$ foo}", а не bar почему: S

1 Ответ

0 голосов
/ 07 февраля 2012

Вы, похоже, пропускаете звонок на display().Для типичного образца шаблона требуется следующий

// test.php
require("../src/class.template.php");
$tpl = new Template_Lite;
$tpl->compile_dir = "compiled/";
$tpl->compile_dir = "templates/";
$tpl->assign("foo","bar");

$tpl->display("test.tpl");

и шаблон в templates/test.tpl

<html>
<head>
<title>Document Title</title>
</head>
<body>
{* this is a comment *}
{ $foo }
</body>
</html>

URL, который вы запрашиваете в своем браузере, будет test.php

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...