CrisTany Posted August 4, 2014 Report Posted August 4, 2014 (edited) Nu gasesc in documentatie chestia asta, deci eu am un Bundle creat pe care imi incep proiectul (invat inca framework-ul) si un controller care imi introduce niste date in db de fiecare data cand accesez route-ul lui si imi afiseaza ce introduce. Cum fac style la pagini ?Am cautat pe net si am gasit ceva legat de assets, dar nu imi pot da seama inca. Ceva ajutor sa imi mearga mai repede treaba ?Sau sa am un header comun la toate template-urile (views, html.twig de la fecare controller), chestia e ca am gasit base.html.twig care are partea de head, dar tot nu reusesc sa fac cum vreau.Multumesc Edited August 4, 2014 by CrisTany Quote
ikamann Posted August 4, 2014 Report Posted August 4, 2014 this dosnt help u?Creating and Using Templates (The Symfony Book) Quote
CrisTany Posted August 5, 2014 Author Report Posted August 5, 2014 nu ma ajuta. am Incercat sa pun in base.html.twig link la style-ul meu, dar nu are efect in bundle la project. Quote
darkking Posted August 6, 2014 Report Posted August 6, 2014 (edited) Vezi: The Templating Helpers (The Symfony Components)La tine in header:PHP: <link href="<?php echo $view['assets']->getUrl('css/style.css') ?>" rel="stylesheet" type="text/css" />TWIG: <link href="{{ asset('css/style.css') }}" rel="stylesheet" type="text/css" />sau daca ai template-ul tau deja creat si vrei sa-l folosestiuse Symfony\Component\HttpFoundation\Response;..........$loader = new \Twig_Loader_Filesystem('/locatie/template/');$twig = new \Twig_Environment($loader, array( 'cache' => __DIR__.'/../../../../app/cache/custom',));$tmpl = $twig->loadTemplate('base.twig.html');$response = new Response();$response->setContent($tmpl);return $response; Edited August 6, 2014 by darkking Quote