Welcome to Geeklog, Anonymous Thursday, November 28 2024 @ 06:56 pm EST

Geeklog Forums

Theme Switcher


Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
curious
I want to have a theme switcher for my site. Actually just a switch between two. I have seen the stories with code snippets for a switcher but one comes as not found, and the other, relies on the code from the first.

Any ideas?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Try searching for "theme tester". In fact, we've just been through all this a week or two ago.

bye, Dirk
 Quote

Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
is there a way for an admin type person to have this pulldown show up, on their admin page, and the theme then change for all anonymous users?

Cool, thanks. i was thrown off when I searched before because the search results that were recent had "0" replies. But I clicked on the first one and I all is well. Thanks again.


Quote by Dirk: Try searching for "theme tester". In fact, we've just been through all this a week or two ago.

bye, Dirk

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by spatz4000: is there a way for an admin type person to have this pulldown show up, on their admin page, and the theme then change for all anonymous users?

Hmm, the anonymous users get to see the default theme, which is set in config.php. That would be tricky to do and involve having a writable config.php file, which doesn't sound like a good idea from a security point of view ...

A more doable approach may be to write the admin's selection to the database (to, say, the gl_vars table) and then have a piece of custom code in lib-custom.php that pulls that out of the table again and sets $_USER['theme'] for anonymous users (for which it's not normally set). Not sure if that'll work, but I think it would. Now you only need to find someone implementing it ...

bye, Dirk
 Quote

Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
I know a little PHP, so that'll be my project for Tuesday. I'm basically trying to make theme selection as simple as possible ( ie the user won't know how to change the config file ). Thanks for the tips.

Quote by Dirk:
Quote by spatz4000: is there a way for an admin type person to have this pulldown show up, on their admin page, and the theme then change for all anonymous users?

Hmm, the anonymous users get to see the default theme, which is set in config.php. That would be tricky to do and involve having a writable config.php file, which doesn't sound like a good idea from a security point of view ...

A more doable approach may be to write the admin's selection to the database (to, say, the gl_vars table) and then have a piece of custom code in lib-custom.php that pulls that out of the table again and sets $_USER['theme'] for anonymous users (for which it's not normally set). Not sure if that'll work, but I think it would. Now you only need to find someone implementing it ...

bye, Dirk
 Quote

Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
Trying to get an idea on what needs done. I would need to add a column to the gl_vars table ( call it default_theme or something )?



Quote by spatz4000: I know a little PHP, so that'll be my project for Tuesday. I'm basically trying to make theme selection as simple as possible ( ie the user won't know how to change the config file ). Thanks for the tips.

Quote by Dirk:
Quote by spatz4000: is there a way for an admin type person to have this pulldown show up, on their admin page, and the theme then change for all anonymous users?

Hmm, the anonymous users get to see the default theme, which is set in config.php. That would be tricky to do and involve having a writable config.php file, which doesn't sound like a good idea from a security point of view ...

A more doable approach may be to write the admin's selection to the database (to, say, the gl_vars table) and then have a piece of custom code in lib-custom.php that pulls that out of the table again and sets $_USER['theme'] for anonymous users (for which it's not normally set). Not sure if that'll work, but I think it would. Now you only need to find someone implementing it ...

bye, Dirk
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by spatz4000: I would need to add a column to the gl_vars table ( call it default_theme or something )?

A row, not a column. gl_vars is just a table of (name, value) pairs used for all sorts of things.

bye, Dirk
 Quote

Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
Ahhhh yeah. It was early, ot late. Or something. Thanks agin Smile


Quote by Dirk:
Quote by spatz4000: I would need to add a column to the gl_vars table ( call it default_theme or something )?

A row, not a column. gl_vars is just a table of (name, value) pairs used for all sorts of things.

bye, Dirk
4
 Quote

Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
Quote by Dirk:

again and sets $_USER['theme'] for anonymous users (for which it's not normally set). Not sure if that'll work, but I think it would. Now you only need to find someone implementing it ...


How or where do I set $_USER['theme']? That's referencing gl_users in the database? or not?
 Quote

Status: offline

spatz4000

Forum User
Junior
Registered: 07/14/06
Posts: 25
Okay. I have the database being written to, and I can also read from the database, the info I need. Where I am stuck is where, in what file do I need to set $_USER['theme']?

Quote by Dirk:
Hmm, the anonymous users get to see the default theme, which is set in config.php. That would be tricky to do and involve having a writable config.php file, which doesn't sound like a good idea from a security point of view ...

A more doable approach may be to write the admin's selection to the database (to, say, the gl_vars table) and then have a piece of custom code in lib-custom.php that pulls that out of the table again and sets $_USER['theme'] for anonymous users (for which it's not normally set). Not sure if that'll work, but I think it would. Now you only need to find someone implementing it ...

bye, Dirk
 Quote

All times are EST. The time is now 06:56 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content