/** * @Route("/editfooter/{id}",name="editfooter") * @ParamConverter("article", class="hkgbiWebBundle:Article") * @Method({"POST","GET"}) */ public function editFooter(Article $article, Request $request, $id) { $em = $this->getDoctrine()->getManager(); $content = $article->getContent(); $form = $this->createForm(new FooterType(), $article); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em->flush(); return new Response("<script>alert('修改成功');window.location.href='/admin/footerlist'</script>"); } return $this->render('hkgbiWebBundle:backend/footer:editfooter.html.twig', array('form' => $form->createView(), 'id' => $id, 'content' => $content)); }
/** * @Route("getmodule/article/{id}",name="article") * @ParamConverter("article", class="hkgbiWebBundle:Article") */ public function getArticleAction(Article $article, $id) { if ($article->getModule()->getIdentifier() == "about_us") { $mem_obj = $this->mem(); if ($mem_obj->doFetch("article_{$id}")) { $content = $mem_obj->doFetch("article_{$id}"); } else { $content = $article->getContent(); $mem_obj->doSave("article_{$id}", $content, 0); } } else { $content = $article->getContent(); } return new Response("{$content}"); }