我是新來的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