View Full Version : Style inheriting into serch/members etc etc
chilliboy
Wed 20th Jun '01, 6:58am
Hi,
I was wondering how to get the styles applied to a forum inherited by the search/user cp pages etc etc.
At the moment, say I got a forum "green forum" and someone clicks search from that forum, then the search page styles resort to the default styles. This looks reaaly stupid when the default style and "style for forum" colours clash. How can I make the search pages etc inherit the styles from the appropriate forum?
Cheers
tubedogg
Wed 20th Jun '01, 7:01am
There's no way to do what you suggest currently. The best you can do is allow the user to specify a style that overrides any that you have set and then everything will be in that style.
chilliboy
Wed 20th Jun '01, 7:29am
I've noticed a few people pass the styleid in their URLs
Smachol: If you look at his signiture the $styleid is passed in the URLs eg http://www.optiboard.com/forums/index.php?s=&styleid=20 , I had a look and tried various stylesid , I noticed that if you click search, cp etc the styleid is retained. Any ideas on how this is done. I thought it may be by passing it on via the url to search.php but there vas no visible $styleid in the URL.
Any ideas on how it is accomplished ??
Cheers
tubedogg
Wed 20th Jun '01, 7:43am
That's a different question. ;) Yes, find out the ID of the style (Templates > Edit > mouseover the [expand list] link and look at the status bar, it will say "expandset=xx" where xx is the ID) and then append it to a URL with
&styleid=xx
where xx is your style id. It's then stored in a cookie. Make sure none of your forums have "override user-specificed style" set to yes.
However this won't do what you initially asked because then if they go to another forum (say that one is supposed to be red) it will keep the green, unless you force override styles as noted above.
Also there's no easy way to set the search link with a different style id depending on which forum you're in.
chilliboy
Wed 20th Jun '01, 8:21am
Thanks for your help.
Just thinking: and it brings me back to my post below on "$Variables accessible to includephp" - is it possible to set to set the styleid variable in there?
If so it brings me back to the switch statement I want to do - If I can find out which forum a user is currently in, what are its parent forums etc then I can set the $styleid by this. Also if this is executed before 'headers' are sent or more specifically cookies are sent then I should be able to accomplish what I want.
I had a look at the functions in functions.php and found the 2/3 that I think I'm looking for:
function getuserinfo ($userid) {
global $DB_site;
static $usercache;
if (!isset($usercache[$userid])) {
$usercache["$userid"]=$DB_site->query_first("SELECT user.*,userfield.* FROM user LEFT JOIN userfield ON userfield.userid=user.userid WHERE user.userid='$userid'");
$usercache["$userid"]['showsignatures'] = iif(($usercache["$userid"]['options'])&SHOWSIGNATURES,1,0);
$usercache["$userid"]['showavatars'] = iif(($usercache["$userid"]['options'])&SHOWAVATARS,1,0);
$usercache["$userid"]['showimages'] = iif(($usercache["$userid"]['options'])&SHOWIMAGES,1,0);
$usercache["$userid"]['showvbcode'] = iif(($usercache["$userid"]['options'])&SHOWVBCODE,1,0);
}
return $usercache[$userid];
}
AND
// ###################### Start getforumarray #######################
function getforumarray($forumid) {
global $DB_site,$forumcache;
static $forumarraycache;
if (isset($forumarraycache["$forumid"])) {
return $forumarraycache["$forumid"];
} else if (isset($forumcache["$forumid"])) {
return $forumcache["$forumid"]['parentlist'];
} else {
$foruminfo=$DB_site->query_first("SELECT parentlist FROM forum WHERE forumid='$forumid'");
$forumarraycache["$forumid"]=$foruminfo['parentlist'];
return $foruminfo['parentlist'];
}
}
// ###################### Start getforumlist #######################
function getforumlist($forumid,$field="forumid",$joiner="OR",$parentlist="") {
global $DB_site;
if (!$parentlist) {
$parentlist=getforumarray($forumid);
}
return "($field='".implode(explode(",",$parentlist),"' $joiner $field='")."')";
}
I guess useing these will give me some variables which will indicate which forum the current user is in ($forumid is passed via url any way so I can use that).
I don't know however what the $Variables outputed by these functions will hold.
If you know what going on here and know how I could get the array of 'parent forums' and forum names relating to these 'forumids' I'd be really grateful.
Cheers
Powered by vBulletin™ Version 4.0.0 Beta 4 Copyright © 2009 vBulletin Solutions, Inc. All rights