Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
stylesheet for iphone
perblo #1
Member since Feb 2009 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: stylesheet for iphone
I want to adjust the stylesheet for a dokuwiki page so it also fits in a iphone browser.

One way could be to add a line in template.php, rewrite php.css slightly and use separate css files like this:
<link rel=”stylesheet” media=”only screen and (max-device-width:480px)” href=”small-devices.css” type=”text/css” />
<link rel=”stylesheet” media=”screen and (min-device-width:481 px)” href=”not-small device.css”>

An other way could be to check if the string "iPhone" exists in $_SERVER['HTTP_USER_AGENT'] and rewrite /exe/php.css so it loads different css files.

Has anyone done anything like this? I don't really like any of the methods since I will need to rewrite it for every new release of dokuwiki.
Can it be done using a plug in instead?

jelevin #2
Member since Feb 2008 · 1 post
Group memberships: Members
Show profile · Link to this post
I would also like a recommendation to accomplish this.  Is there a way to flex the template or css by user?  by browser? to have the user select and have this selection stick?  There must be (at least one) way.
andi (Administrator) #3
User title: splitbrain
Member since May 2006 · 3540 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
DokuWiki contains a mobile detection mechanism which sets a variable in the $INFO array (IIRC $INFO['ismobile']).

I once started with a mobile template but then realized that it wouldn't be *much* different from a normal one. Instead I'd prefer to build some mobile optimizations, based on the variable above, directly into the standard template. If you like to help, I recommend joining the mailing list.

Here's a glimpse of my previous attempts:

Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
perblo #4
Member since Feb 2009 · 2 posts
Group memberships: Members
Show profile · Link to this post
That looks good.
It sounds like a good thing to use $INFO['ismobile'] and adjust the css to fit a smaller screen, but how. As I can see in the in the dokuwiki code there is no easy way to create a conditional css output. Would it be better to append a additional css file to the css output if the browser is mobile? As far as I know a declaration in the css file overwrites a previously specificied declaration so this would be a way to have a mobile touch to the css.
Is this a good way to do it?

Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-04-06, 04:33:43 (UTC +02:00)