Dr. Tarique Sani,您好!
I am not good enough to write a tutorial like others. I am just newbie. But, I
am glad to share my experience.
First, the theme.php will handle the rest, when u set your theme. Just put the
theme.php into the folder of views. And, in your app_controller, set var $view
= 'Theme' first. Now, what we should do is just pass a value to Theme, a simple
way is just var $theme=yourtheme, just like Dr. T said.
Second, to let the code above works, we should creat a new yourtheme folder
both in views and webroot folders. Like the default Cake does. In your
views/yourtheme, you should have layout. And in the webroot/yourtheme, you
should have css/js/img...(Do more works here, make it different)
Ok, it just works.
But, When you want to make some speical for users, who can choose what he like,
one way, I used is session. (Surely,there is other ways, I am keep looking.)
And, I am using the simpleAuth from the Cake-Manul, it is simple can clear.
Read the manul first, you will find like session-write, and session-read. I
learn from the irc channel how the session works. Creat a new field called
theme in your user table. And make is load into session, as username,password.
Using $this-Session-write('Theme', $someone['User']['theme']) to write the
current users' theme into session. And then ,what you need to do is just read
it from session and pass it to the $theme.
Using a fuction in app_controller:
function beforeFilter()
{
if ( $this-Session-check('Theme') )
{
$this-theme = $this-Session-read('Theme');
}
}
That's it. Simple but need more works to know the whole picture.
BTW, I am trying to make a function like when a vistor click a drop-down list
to choose a theme, and the theme can save it into cookies. Just for the
non-login users.
Dr.Tarique Sani can u give me some advices? I am not clear about how to pass
the value to $theme, when a vistor choose a theme by a drop-down list.
Thanks.
Hopes it clear and make helps.
=== 2006-11-17 00:25:47 您在来信中写道:===
On 11/17/06, xeboy [EMAIL PROTECTED] wrote:
Dr. Tarique Sani,您好!
Thanks. For your kind and patient!
I got it. Hehe
Great! now please write a tutorial about it show all the steps needed
to get it right ;)
Tarique
--
=
PHP Applications for E-Biz: http://www.sanisoft.com
Coppermine Picture Gallery: http://coppermine.sf.net
=
= = = = = = = = = = = = = = = = = = = =
致
礼!
xeboy
[EMAIL PROTECTED]
2006-11-17
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Cake PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---