PDA

View Full Version : Request: Forum Style Hack


bengyeow
09-04-2002, 01:27 AM
Dear all, would like to request for a hack that allows the users to view another style via http://www.example.com/forums/index.php?styleid=2 and doesn't change the style setting of the user.

This is because I am trying to create a lite version of the forum for use with handheld devices. I would not want the users to have to take the trouble to change style back to the default one when they are accessing it via a Desktop.

Any help would be appreciated.

Cheers,
Beng Yeow

Erwin
09-04-2002, 01:29 AM
Firefly's dropdown style hack - do a search - you'll find it.

bengyeow
09-04-2002, 01:43 AM
Hi Erwin, I need to change the style via a url not a dropdown box, as the resolution on the PDA and the Desktop is very different.

Any other solutions?

bengyeow
09-05-2002, 11:32 AM
Can anyone help ? :)

Logician
09-05-2002, 12:39 PM
Originally posted by bengyeow
I need to change the style via a url not a dropdown box, as the resolution on the PDA and the Desktop is very different.

Any other solutions?
What about putting


if (!$mystyle OR (int)$mystyle<1 OR (int)$mystyle>X or round($mystyle,0)!=$mystyle)
{
$bbuserinfo['styleid']=$bbuserinfo['styleid'];
}
else
{$bbuserinfo['styleid']=(int)$mystyle;}

and then sending your styleid via URL by putting a "&mystyle=Y" variable to your address bar?

Not tested and I'm not sure if it will work, but seems ok in the first look. However you may want to improve the code by adding a few more conditionals to restrict this usage to certain usergroups or hide certain styles' ids etc... This is just the basic algorithm..

bengyeow
09-05-2002, 11:26 PM
Where should I put this?

Logician
09-06-2002, 05:59 AM
global.php .. (eg. before ?> )

bengyeow
09-07-2002, 01:28 PM
Hi Logician, it does not work :(

Anyone have any ideas?

Logician
09-08-2002, 04:32 AM
Try adding the code right after
unset($style); // prevent some weird issues

And while applying it, re-copy paste because I added a missing char to the code. Also dont forget to replace X in the code (it will be your max style id allowed). Tested and it's working.. :)

bengyeow
09-08-2002, 07:29 AM
Hi Logician, should the url look like: http://www.example.com/forums/index.php?styleid=1&mystyle=3

I have implemented and tested, still does not seem to work.

Regards,
Beng Yeow

g-force2k2
09-08-2002, 07:45 AM
bengyeow can't you just user it like the link you posted in your first post?

index.php?styleid=3

?

regards...

g-force2k2

bengyeow
09-08-2002, 07:53 AM
I tried that, doesn't work either, I can change that style but the settling doesn't keep to the original default style.

g-force2k2
09-08-2002, 08:11 AM
eh? so you just don't want it to take precedence over the original default style? so when a user reloads etc they will just get the default style but if they click on a specified forum they'll get the other style? regards...

g-force2k2

bengyeow
09-08-2002, 08:24 AM
Ok, here's what I actually want

Default Style - For the main site
Forum Lite Style - For the Pocket PC version of the site.

Because Pocket PC displays a lower resolution compared to the desktop, it has to have a separate style to fit the screen.

Currently if I access the Forum Lite Style, it will change the user setting and set that style as default, when I log back onto the desktop, I am seeing the Forum Lite Style.

What I really want now is for the user to be able to access the Forum Lite style via an URL, while keeping the style setting as default so that when the user surfs the forum via Desktop, the user do not require to switch style.

Hope you can help.

Regards,
Beng Yeow

Erwin
09-08-2002, 09:15 AM
You can't do it.

If you use the ?styleid=x URL it saves onto a cookie, not into the user table. If you use the modify profile to save it into the user table, and the user uses the same account on another computer, then the style will be permanent - there is no way you can come up with a hack that can distinguish between computers...

One way is to redirect the user according to their browser, or display settings... that is possible, and not hard to do... just use Javascript.

bengyeow
09-08-2002, 09:31 AM
Hi Erwin, the problem is, Javascript is not supported on Pocket IE, is there anyway we can call up the forum in the new style yet not set the styleid into the cookie. Any help would be appreciated.

Logician
09-08-2002, 12:01 PM
Originally posted by bengyeow
Hi Logician, should the url look like: http://www.example.com/forums/index.php?styleid=1&mystyle=3

I have implemented and tested, still does not seem to work.

If you applied my code correctly (and changed X too, the URL
http://www.example.com/forums/index.php?mystyle=3
will work provided that you dont apply a mandatory style in your forum.

Say if you have style A, B and C and all of them selectable in all the boards (you can have a default one but not a mandatory one) then my code will change the style of the user if it's called from the address bar. I tested it and it is working..