Sunday, December 8, 2013

Re: Layout question - adding a class to a wrapper div

Hi

I always put this to my layout body:

<body class="<?php echo $this->params->controller ?>">

So I am ready to call each rendered controller separately via css. Sure, you could also add "$this->params->action" to have finer granulation :)

Cheers,
Frank

Am Freitag, 6. Dezember 2013 18:26:50 UTC+1 schrieb Dave M.:
Let's say I have a default layout containing this body (overly-simplified):

<div id="wrapper">
  <div id="nav">
   <!-- some nav stuff -->
  </div>
 <div id="content">
   <?php echo $this->fetch('content'); ?>
 </div>
</div>

I have a need to add a class to the wrapper id for a couple of pages on my site.
It seems like creating a new layout is overkill for just one minor addition when everything inside the wrapper div is the same.

Any ideas on how to accomplish this?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: