Thanks!
On 4/29/2012 2:19 PM, lowpass [via CakePHP] wrote:
You don't need to create separate CSS files for each user. If the new
styles are very few you can use $this->Html->style() to include a new
style block. But don't add the users' styles to Config. Instead, save
a serialised array to the users table. Look at the Html::style()
method to see how the array is expected to look.
If you prefer to have separate CSS files for each user, create the
file ONCE when the user chooses what they want (however you're doing
that) and then store the filename (without extension) in the users
table. Then you will be able to get the name from
$this->Auth->user('css') (or whatever you name the column).
If storing css rules:
if ($css = $this->Auth->user('css'))
{
$this->Html->style(unserialize($css));
}
If storing filenames:
if ($css = $this->Auth->user('css'))
{
$this->Html->css("users/${css}");
}
On Sat, Apr 28, 2012 at 7:09 PM, bs28723
<[hidden email]> wrote:
> 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
> [hidden email] For more options, visit this group at
> http://groups.google.com/group/cake-php
--
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-tp5672783p5674444.htmlTo 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:
Post a Comment