This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

dynamic dom class attribute by controller

Other symfony projects

dynamic dom class attribute by controller

by paskuale » Wed Dec 14, 2011 11:26 am

Hi all, I am new to this framework, the body tag in your template base.html.php has a dynamic class (if you're not logged in has class = "no-login" otherwise no class). I thought I would manage the $ from the controllers body_class MyBundle / Controller / LoginController
Code: Select all
public function indexAction()
    {
        $body_class='special-page login-bg dark'; // CLASS OF BODY TAG
        return $this->render('SanipackMainBundle:Login:index.html.php', array('body_class' => $body_class));
    }



Now in base.html.php template I have only <head>....</head> and empty <body class="<?php echo $view->escape($body_class);?>"></body>

If my url is ..../login ok but other cases it's return error $body_class vars not exist !! How can do it ?

Thanks
paskuale
Junior Member
 
Posts: 2
Joined: Wed Dec 07, 2011 7:46 pm