请记住,我对mac和symfony一般都是新手,所以如果我遗漏了任何基本原因,那就是为什么。
首先,这就是我的文件夹结构 -
/src
/TeamRock
/Fortress
/Platform
/Sites ---> the bundles are stored in "Sites"
/ExampleBundle
/CalvinBundle <-bundle where i am working->
/Controller
/WelcomeController.php
/Resources
/config
/views
/CalvinIndex
/index.html.twig
/DependencyInjection
这是我的Controller类
<?php
namespace TeamRock\Sites\CalvinBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
/**
* Class Welcome
* @package TeamRock\CalvinBundle\Controller
* @Route("/calvin")
*/
class WelcomeController extends Controller
{
/**
* @Route("/index", name="calvin_test_index")
*/
public function indexAction (){
return $this -> render('TeamRockSitesCalvinBundle:CalvinIndex:index.html.twig');
}
}
Twig文件只是几个基本单词,但问题是我的渲染?我确定它是,我已经查找了文件“捆绑的路径等,这使得我很不确定我哪里出错了
任何问题或其他代码只需评论!谢谢你提前帮忙!
卡尔文!
答案 0 :(得分:1)
有史以来最大的faceplam,这是我的观点文件夹,我的名字“视图”忽略了很多次......无论如何都欢呼帮助
答案 1 :(得分:-1)
试试这个:
return $this->render(
'TeamRock\Sites\CalvinBundle\Resources\views\CalvinIndex\index.html.twig'
);