我是新来的Symfony2在某些部分struked文件如何呈现在树枝
我的问题是需要链接到一个单独的页面时,我的一些按钮点击,我的网址链接到页面,但在页字段不显示
//controller(Action function)
public function displayAction(Request $request){
if($request->isXmlHttpRequest()){
$photos = new TcPhotos();
$photos_form = $this->createForm(new PhotoType(), $photos);
$response = new JsonResponse();
$response->setData(array('content' => $this->renderView('TcPhotoBundle:Default:display.html.twig',array('form' => $photos_form->createView()))));
return $response;
}else{
$response = new JsonResponse();
$response->setData(array('content' => 'something went wrong'));
return $response;
}
}
//view.html.twig
<div><a href="#!{{ path('tc_photo_display') }}">more .....</a></div>
//root
tc_photo_display:
pattern: /display
defaults: { _controller: "TcPhotoBundle:Default:display" }
请帮助我更好的解决方案,我只是需要当我点击更多view.html页
请提供您的display.twig文件,其中包含哪些数据包含$ photos变量? – hizbul25