Welcome to Geeklog Wednesday, January 23 2019 @ 01:26 pm EST

Geeklog Forums

Theme Swapper


Status: offline

Tony

Site Admin
Admin
Registered: 17/12/01
Posts: 405
Location:Urbandale, Iowa
If haven't noticed, we've added a handy little theme swapper inside of a block here. This is handy for testing or for giving your users an easier alternative to changing themes. Get the code for it here
The reason people blame things on previous generations is that there's only one other choice.

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany

It seems you forgot to mention that you also need a bit of code that goes into lib-common.php to makt this work:

if (!empty($usetheme) AND is_dir($_CONF['path_themes'] . $usetheme)) {
$_CONF['theme'] = $usetheme;
$_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
$_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
}
else if ($_CONF['allow_user_themes'] == 1) {

Only that last line (minus the "else") is already there ... Add this and then it will work.

bye, Dirk


Status: offline

Tony

Site Admin
Admin
Registered: 17/12/01
Posts: 405
Location:Urbandale, Iowa
Sorry, yes, you are right. A small but important amount of code.
The reason people blame things on previous generations is that there's only one other choice.

Status: offline

squatty

Forum User
Full Member
Registered: 21/01/02
Posts: 269
Theme swapper appears to be ignoring my default theme ($_CONF['theme'] = 'clean'Wink. When I set the allow_user_themes = 1 and enable the theme swapper block, users are directed to the DotCom theme instead of the Clean theme? Any ideas on what's going on? Thnx!
In a world without walls and fences, who needs Windows and Gates?

Anonymous

Anonymous
can you specific, where there are put this codec? or how is install, this?

Status: offline

Tony

Site Admin
Admin
Registered: 17/12/01
Posts: 405
Location:Urbandale, Iowa
You put this in lib-common.php. It'll be at the top. You notice some of the existing code in the snippet above. If you can read PHP code, it should be really obvious.
The reason people blame things on previous generations is that there's only one other choice.

Status: offline

saltlakejohn

Forum User
Newbie
Registered: 17/12/01
Posts: 9
Location:Utah, USA
1) take the code snippet from http://www.geeklog.net/article.php?story=20020506133826910 and put it into lib-common.php. All that code replaces the single line of code: if ($_CONF['allow_user_themes'] == 1) { (Watch out for the curly braces, don't get them wrong.) 2) Then take the cleaned up code from http://www.geeklog.net/phpblocks/themetester.phps and put it into lib-custom.php 3) Login as admin and make a php block for homeonly. Read there that when you call a phpblock function that you do NOT use the parentheses. ----- John
-- John

All times are EST. The time is now 01:26 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