Saturday, April 28, 2012

Re: Can you dynamically change CSS for a layout per user?

Thanks Michael.      I think I could solve the problem of having the code in every controller by doing.......

class AppController extends Controller {
   public function beforeRender() {
            $newCss = $this->Config->getCss($username);
            $file = new File('/webroot/css/users/" . $username, true, 0644);
            $file->write($newCss);
            $file->close;
            $this->set('cssfile', '/webroot/css/users/" . $username);
   }
}

in layouts/default.ctp
  <?php echo $this->Html->css($cssfile, null, array('inline' => false));  ?>

But --
   Is there a way to add the CSS inline, and not create and write a new file each time?
   with 100 users online at the same time, this could be a performance issue????

Thoughts?


On 4/28/2012 6:23 PM, Michael Gaiser [via CakePHP] wrote:
Would it be possible to just put a test in your app_controller.php and
then make use of it in your \View\Layouts\default.ctp file? That way
all your pages get it by default and you do not need to drive yourself
crazy with placing that code everywhere.

~Michael

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php



If you reply to this email, your message will be added to the discussion below:
http://cakephp.1045679.n5.nabble.com/Can-you-dynamically-change-CSS-for-a-layout-per-user-tp5672783p5673236.html
To start a new topic under CakePHP, email [hidden email]
To unsubscribe from CakePHP, click here.
NAML


View this message in context: Re: Can you dynamically change CSS for a layout per user?
Sent from the CakePHP mailing list archive at Nabble.com.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: