You are here: Re: How can I show different style sheets according to user? « All PHP « IT news, forums, messages
Re: How can I show different style sheets according to user?

Posted by Balazs Wellisch on 12/30/05 05:33

Your signup form would have something like this:

<select name="style">
<option value="style1">Style One</option>
<option value="style2">Style Two</option>
</select>

You would than insert that value into your db table. Let's say into a field
called 'style'. The other fields would contain the user ID, username,
password, etc.

The when they login you'd retrieve the contents of the style field the same
way you'd retrieve everything else. How you do a SQL query depends on you. I
tend to use the adodb abstraction layer (http://adodb.sourceforge.net/) so
my result sets end up looking something like this:

$rsUser->fields['style'];

Yours may look completely different. In any case that's what the variable
$choice refers to in my earlier example.

Sounds like Santa forgot to stash that PHP book in your stocking! :)

B


"digit" <ddfdfs@ddd.org> wrote in message
news:8X0tf.2508$L53.1650@trndny07...
>
> "Balazs Wellisch" <balazs@neusolutions.com> wrote in message
> news:TE%sf.8334$hI1.4266@tornado.socal.rr.com...
>> You'd store their option of choice in a database table just like you'd
>> store the rest of their registration information. Then when they login
>> you place a conditional in the header of your pages that will decide
>> which stylesheet to load. Something like...
>> <?php
>>
>> switch( $choice )
>> {
>> case 'style 1':
>> $stylesheet = '/path/to/style1.css';
>> break
>> case 'style 2':
>> $stylesheet = '/path/to/style2.css';
>> break
>> }
>>
>> ?>
>>
>> <link href="<?php print $stylesheet ; ?>" rel="stylesheet"
>> type="text/css">
>>
>> Makes sense?
>
> Can you please clarify for me, in your example 'style 1' and 'style 2' are
> database columns and are what I named the check boxes on my registration
> form? And $choice arghhh, I can't seem to find where to plug that one in
> on the form!
> Sorry for the very basic questions, I'm fairly new to PHP (obviously), but
> tryin' :)
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация