Friday, December 6, 2013

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

I don't see any problem.

I think this is normal.


2013/12/6 Dave M. <milsom@gmail.com>
I considered that approach. But what about the rest of the pages?
I could do something like:

if (!isset($myWrapperClass)) {
 echo "<div id='wrapper'>";
} else {
 echo "<div id='wrapper' class=$myWrapperClass>";
}

Is that too clumsy?

On Friday, December 6, 2013 12:44:16 PM UTC-5, Leandro Machado Pereira wrote:
Try this.

In you controller
$this->set('wrapperID', $myWrapperID);

In your layout
echo $wrapperID;

Best regards;


2013/12/6 Dave M. <mil...@gmail.com>
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+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.



--
***Se você pretende redirecionar este e-mail, por favor, apague todos os endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e a Campanha Contra o SPAM agradecemos.Não envie correntes.***

--
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.



--
***Se você pretende redirecionar este e-mail, por favor, apague todos os endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e a Campanha Contra o SPAM agradecemos.Não envie correntes.***

--
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: