Hey , this is an information about the current preview system. Because all partials and all components use by the selected layout are in the "frontendPlugin", I just have to prepare datas in the action to render the preview. Thanks to Doctrine relations I don't have to save any object's modifications in DB.
My preview action : public function executePreview(sfWebRequest $request) { $this->in_page = $this->getRoute()->getObject(); $this->form = $this->configuration->getForm($this->in_page); $this->in_page = $this->processPreviewForm($request, $this->form); $this->forward404Unless($this->in_page); $this->recherche = null; if(!is_null($this->in_page->getInLayout()->getName())) { $layout=$this->in_page->getInLayout()->getName(); $metas = $this->in_page->getAllMetas(); $this->getContext()->getRequest()->setAttribute('meta_description', $metas['descriptions']); $this->getContext()->getRequest()->setAttribute('meta_keywords', $metas['keywords']); $this->getContext()->getRequest()->setAttribute('category', $this- >in_page->getInCategory()); $this->getContext()->getRequest()->setAttribute('page_id', $this- >in_page->getId()); } $response = $this->getResponse(); $response->addStyleSheet('styles.css'); $response->addStyleSheet('menu.css'); $response->addStyleSheet('menu-v.css'); $response->addStyleSheet('gbx_simple.css'); $response->addStyleSheet('styles_menu.css'); $response->addStyleSheet('styles_shirka.css'); $response->addStyleSheet('styles_vh.css'); $response->addJavascript('jquery-1.3.2.min.js'); $response->addJavascript('jquery.gbx-1.0.1.js','last'); $response->addJavascript('jsmenu.js'); $response->addJavascript('scripts.js'); $response->addJavascript('jquery.scrollTo-min.js'); $response->addJavascript('jshead.js'); $response->addJavascript('carroussel.js'); $response->addJavascript('jcarousel.pack.js'); $response->addJavascript('http://maps.google.com/maps/api/js? sensor=true'); $response->addJavascript('frontend.js'); $this->setLayout($layout); } public function processPreviewForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName()), $request- >getFiles($form->getName())); if ($form->isValid()) { $page = $form->previewObject(); foreach ($request->getParameter('zone') as $zone_id=>$zone) { foreach ($zone['content'] as $content) { if("" != $content) { $relation = new InRelationship(); $relation->in_article_id = $content; $relation->in_page_id = $page->getId(); $relation->in_zone_id = $zone_id; $relation->in_template_id = $zone['template']; $page->Relationships[] = $relation; } } } return $page; } else { $this->getUser()->setFlash('error', 'The item has not been previewed due to some errors.', false); } } Yes this code can be refactor ;) So do you think there is a better way to do a preview ? Julien -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@googlegroups.com. To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en.