php - How do I give Symfony templates a CSS class based on their navigation path -


I am trying to present the templates with a CSS class in Symphony, from which it shows that they Belong to the site. For example: I am in / Games I like to see the page:

  & lt; Div id = "wrapper" class = "games" & gt; & Lt ;! - content - & gt; & Lt; / Div & gt;  

Or if we're displaying / home / profile , the page will look like this:

  & lt; Div id = "wrapper" class = "home" & gt; & Lt ;! - content - & gt; & Lt; / Div & gt;  

Actually I am looking for the same functionality for CodeIgniter's url section methods.

Is the class only the name of the module? If so, do so:

  & lt; Div class = "& lt ;? php echo $ sf_context- & gt; getModuleName ()? & Gt;" & Gt;  

You can also define it in your routes as a parameter on the request:

  page: url: / page param: { Module:  

Then close the request in your template:

   preExecute : 

>

  public event preExecute () {$ this-> GetRequest () - & gt; SetParameter ('section', 'workouts'); }  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -