Page 1 of 1

exsisting stylesheet changer script into sy9 for swap sytle

Posted: Fri Aug 08, 2008 8:30 pm
by machinedragon
hello ,
first off i wanted to thank everyone here for a nice clean blog that i have been using on my website at http://mangablog.machinedragon.com


on my main website , i have created my own php stylesheet switcher , to change between a few themes ive created for my homepage. id like to be able to do a simmilar thing to my blog, but im a lil lost on where to implement it ,
i would like to be able to continue my method into sy9 with the same basic premice of my homepage stylesheet switcher.

since the code ive made is pretty ugly and does alot of strange things ill just go over what it is doing , and if a php guru wants to see the code , ill email it to them.

first , reads style cookie , if none exsists , defaults to my darkback/light text theme
if a cookie exsists , checks against array of predefined theme names

checks header and other tell tale info that the user might be on a mobile device, and simply displays pure html , with no style ,however the style links continue to work because they only change the logos at this time.

if it is not mobile , it writes out the standard statement for the selected theme , and a alternate style link for the other theme. ( gives the chance for a preload in good browsers , and displays in list of themes for firefox.

right now , im still using one of the built in sy9 themes , but before i attempt to make a skin that matches my homepage. i want to know

is it possible to have sy9 read my style cookie, and depending on the predefined list of names, change the style to match what the user selected when they went to my home page.

it may not be possible , because of my blog being on a subdomain, but id be happy with 2 little links at the bottom of the page that change from black text/white back & vice versa

Re: exsisting stylesheet changer script into sy9 for swap s

Posted: Sat Aug 09, 2008 11:41 am
by garvinhicking
Hi!

s9y has its own template switcher plugin, the "Template chooser" sidebar and event plugins. If you only use the event plugin, you can easily switch thetemplate with your own links via index.php?serendipity[template]=XXX.

You could also patch those plugins to read the contents of your cookie :)

HTH,
Garvin

Posted: Fri Aug 15, 2008 10:09 pm
by machinedragon
so does the sy9 switcher have functions to detect mobile devices. because in my script i have the ability to serve a mobile specific stylesheet.

if it dosent, is there any way to add my function that checks ?

because the real world use is this,
main site has 3 themes
dragonmind
idragon
capsue (staff use, untill its ready)

, in any case, id have to make 3 themes with the same names correct ?

and as the users leave my main page into the blog , the blog reads for the name in cookie , and ( only if its not a mobile ) apply stylesheets.


and whats the name of that plugin since on my webserver sparticus dosent work

Posted: Mon Aug 18, 2008 12:35 pm
by garvinhicking
Hi!
machinedragon wrote:so does the sy9 switcher have functions to detect mobile devices. because in my script i have the ability to serve a mobile specific stylesheet.
No, it has not. But a stylesheet-switched can be facilitated into a smarty function, that you can embed in your index.tpl template file. Smarty functions are registered through a config.inc.php file in your template directory, see this: http://www.s9y.org/78.html
and whats the name of that plugin since on my webserver sparticus dosent work
It comes with serendipity, in plugins/serendipity_event_templatechooser/

HTH,
Garvin