Just started using Dokuwiki and surprised how little help is available on the forum.
Merovingio76, I don't know if you ever found a solution. If you have it would be nice if you could post it. I am sure there has to be others that are also still looking for such a solution. I came up with this solution but would be nice to hear from others if there is any better solution.
My solution requires editing the ~/inc/template.php file, near the top there is a function
template($tpl) which sets the path for the template. I edited this function to be.
function template($tpl){
global $conf;
if(clientismobile()) {
if(@is_readable(DOKU_INC.'lib/tpl/dokumobile/'.$tpl))
return DOKU_INC.'lib/tpl/dokumobile/'.$tpl;
return DOKU_INC.'lib/tpl/default/'.$tpl;
} elseif (@is_readable(DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl)) {
return DOKU_INC.'lib/tpl/'.$conf['template'].'/'.$tpl;
} else {
return DOKU_INC.'lib/tpl/default/'.$tpl;
}
}
The
clientismobile() function is already included in ~/inc/common.php file which leads me to believe that there may already be some kind of integration for switching templates for mobile browser but I couldn't find anything. So I came up with the mod of the template() function.
If it is mobile browser returns the
dokumobile template, if
dokumobile template is not available it returns
default template. If not mobile it returns the template saved in configuration. Else defaults to
default template.