Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
public:dokuwiki_goes_mobile [2010/04/25 15:57] – created Nicopublic:dokuwiki_goes_mobile [2015/03/12 21:24] (current) – no more dirty hack :) Nico
Line 1: Line 1:
 +**WARNING**: This hack does not work anymore, but you can now handle mobile skins in a much proper way through the [[https://www.dokuwiki.org/plugin:loadskin|loadskin]] plugin.
 +
 ====== Making dokuwiki handle mobile devices ====== ====== Making dokuwiki handle mobile devices ======
 ===== Install some mobile template ===== ===== Install some mobile template =====
Line 6: Line 8:
 ===== Fix dokuwiki ===== ===== Fix dokuwiki =====
 The main trick here is that dokuwiki uses a special function, ismobiledevice() to set a global environment variable called "ismobile". This function is called in inc/common.php; unfortunatly, the templating stuff is handled by inc/init.php, which is called before. We need to fix it. The main trick here is that dokuwiki uses a special function, ismobiledevice() to set a global environment variable called "ismobile". This function is called in inc/common.php; unfortunatly, the templating stuff is handled by inc/init.php, which is called before. We need to fix it.
-==== doku.php ==== 
-Swap the 2 following include lines to load common.php before init.php: 
-<code> 
-require_once(DOKU_INC.'inc/common.php'); 
-require_once(DOKU_INC.'inc/init.php'); 
-</code> 
 ==== inc/init.php ==== ==== inc/init.php ====
 Add the following somewhere before the template definition stuff: Add the following somewhere before the template definition stuff:
 <code> <code>
 +require_once(DOKU_INC.'inc/common.php');
 if (clientismobile()) if (clientismobile())
     $conf['template'] = 'dokumobile';     $conf['template'] = 'dokumobile';
 </code> </code>
-==== lib/exe/css.phplib/exe/js.php ==== + 
-these files don't call common.phpso let's add it (before init.php):+Of courseif you installed [[http://www.dokuwiki.org/template:minimal_mobile|minimal_mobile]]the last line will be: 
 <code> <code>
-require_once(DOKU_INC.'inc/common.php'); +    $conf['template'] = 'minimal_mobile';
-require_once(DOKU_INC.'inc/init.php');+
 </code> </code>