我正在尝试使用 Symfony 2.0 创建一个网站,但我遇到了extend("...") ?>
从<?php $this->extend("...") ?>
.
该网站可在http://symfony.toxic-productions.com/install/web/poshpaws/hello查看。
控制器的代码:
<?php
namespace Acme\HelloBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class HelloController extends Controller
{
public function indexAction($name)
{
//return $this->render('AcmeHelloBundle:Hello:index.html.twig', array('name' => $name));
// render a PHP template instead
return $this->render('AcmeHelloBundle:Hello:index.html.php', array('name' => $name));
}
}
?>
前端页面的代码 (index.html.php)
<html>
<head>
<title>Poshpaws</title>
<?php
$view->extend('::base.html.php');
echo($head);
?>
</head>
<body>
<?php echo($body); ?>
<h1>This is just a page to say: Hello <?php echo $view->escape($name) ?>!</h1>
</body>
</html>