1
studioC
here we are: switching themes from selectable themes with a link ...
  • 2005/4/15 19:17

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


i'm actually playing a bit on testarea of xoopsfactory.


this is a talk i had with jan yesterday which might interest some of you:
Quote:
Michael (09:30 PM) :
i don't want to use a styleswitcher in this case, --- is there a way to change the theme with a link using themebox functionality in the wayhttp://xoopsfactory.com/?themeset_xy
Mithrandir -- Jan -- (09:30 PM) :
you mean as a link?
Michael (09:30 PM) :
yes..
Mithrandir -- Jan -- (09:31 PM) :
sure
Michael (09:31 PM) :
really?
Mithrandir -- Jan -- (09:31 PM) :
in include/common.php
Mithrandir -- Jan -- (09:31 PM) :
find $_POST['xoops_theme_select'] and replace it with $_REQUEST['xoops_theme_select']
Mithrandir -- Jan -- (09:32 PM) :
then you can make a link likehttp://xoopsfactory.com/?xoops_theme_select=default
Mithrandir -- Jan -- (09:32 PM) :
provided the theme is allowed in the site preferences, it will be set as the user's theme
Michael (09:33 PM) :
i'm actually using a nightly cvs onhttp://xoopsfactory.com
Michael (09:34 PM) :
i do not find xoops_theme_select in common.php?
Mithrandir -- Jan -- (09:34 PM) :
oh
Mithrandir -- Jan -- (09:34 PM) :
then it is in class/template.php
Mithrandir -- Jan -- (09:34 PM) :
the loadTheme() method
Mithrandir -- Jan -- (09:34 PM) :
line 261
Michael (09:35 PM) :
and replace post with $_REQUEST
Mithrandir -- Jan -- (09:35 PM) :
yes
Mithrandir -- Jan -- (09:35 PM) :
all 4 occurrences
Michael (09:37 PM) :
it works ..


http://xoopsfactory.com

hope you'll find it as useful as i do
michael

2
m0nty
Re: here we are: switching themes from selectable themes with a link ...
  • 2005/4/15 19:27

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


that's interesting and pretty useful :) cheers michael..

incidentally, is there a clean way of linking 1 theme to a particular template set, and then say if the user selects a different theme, then a totally seperate template set can be used?

3
LazyBadger
Re: here we are: switching themes from selectable themes with a link ...

As it was answered on my same question - yes. Copy theme's templates into /template folder inside needed theme folder.
I use this techique on my Theme Exhibition

4
m0nty
Re: here we are: switching themes from selectable themes with a link ...
  • 2005/4/15 20:56

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


hmmmm thanks LB.

that's 1 solution..

i might try and devise a hack that could make the theme use a template set from the actual db tplsets.. probably calling it via a smarty tag as that would allow the template to be edited via templates manager and then assign a theme to a particular template, but your solution may do till then :)

5
3lr0n
Re: here we are: switching themes from selectable themes with a link ...
  • 2009/4/12 20:33

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


I resurrect this post to ask if there is a way to do this.. it seems to work with old versions, but not with 2.3.3 (no line 261 or loadtheme in template.php).

Any way of changing themes from a link?

thks in advance
Spanish Overclocking Community xoops based site : www.overclocking.es

6
ghia
Re: here we are: switching themes from selectable themes with a link ...
  • 2009/4/12 23:47

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I think it is in /include/common.php now at lines 302 and 303.

7
3lr0n
Re: here we are: switching themes from selectable themes with a link ...
  • 2009/4/13 5:59

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


Thks guia

it works..


I just change the code to

if (!empty($_REQUEST['xoops_theme_select']) && in_array($_REQUEST['xoops_theme_select'], $xoopsConfig['theme_set_allowed'])) {
    
$xoopsConfig['theme_set'] = $_REQUEST['xoops_theme_select'];
    
$_SESSION['xoopsUserTheme'] = $_REQUEST['xoops_theme_select'];
} elseif (!empty(
$_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $xoopsConfig['theme_set_allowed'])) {
    
$xoopsConfig['theme_set'] = $_SESSION['xoopsUserTheme'];


But, is there any way to have the changes store in database?, i mean,, when the session is over the theme became the default again..

thks
Spanish Overclocking Community xoops based site : www.overclocking.es

8
ghia
Re: here we are: switching themes from selectable themes with a link ...
  • 2009/4/13 10:14

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Have the users (login needed!) permission to change their theme in their profile and is the linked theme in the list of allowed themes from the system preferences?

9
3lr0n
Re: here we are: switching themes from selectable themes with a link ...
  • 2009/4/13 14:09

  • 3lr0n

  • Not too shy to talk

  • Posts: 167

  • Since: 2004/3/13


The theme change works for registered users (i cant find where to deny the persmission to change theme for users), and all the themes in the site are user selectible.

When the user logout the theme went to default (this is ok as the session is over) but when a user, who has click on for example, blue theme, in his last login, logout and make login again.. the theme is not blue, is red (default one).

I want this preference to be saved for registered users (the theme changer is not shown for anonymous yet).

thks
Spanish Overclocking Community xoops based site : www.overclocking.es

10
etcetera
Re: here we are: switching themes from selectable themes with a link ...
  • 2009/6/28 20:46

  • etcetera

  • Just popping in

  • Posts: 23

  • Since: 2009/6/13


reviving this topic (again). Any thoughts on how I could take this and twist it to switch themes with image links?

Login

Who's Online

240 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 240


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits