Mobile Theme for Drupal v6

After a few weeks of toying with the latest version of Drupal, I have finally managed to create a very basic theme for version 6. It is a striped down version of bluemarine - without the tables of course.

Some of the functionality of the accessibility module are included in the theme, such as

  • Correct Content Type Header are sent
  • Accesskeys
  • Custom paging
  • Content broken down into manage pieces


There are custom regions built into the theme, that to be honest are not required, but you can at least add to regions that don't exist in other templates if you really want mobile only content. I call the theme bluemobi and it sends XHTML MP profile on most occasions.

There is no profiling as such, so no effort is made to remove comments etc. from the pages. Please ensure that you use valid XHTML - pages may break if you do not.

Features

Headers - user accept string in checked in the following order. Note that there is no WAP/WML template available at this time.

  • application/vnd.wap.xhtml+xml
  • application/xhtml+xml
  • text/html


The correct header and DTD information is then sent to the browser accordingly through http - drupal_set_header and html - $dtd.

Accesskeys - are added in a custom variable called $mobi_links. This is currently amending the $primary_links variable. Two more accesskeys are coded into the custom pager function. This adds 7 and 9 into the equation, so make sure that your primary links don't exceed 5 - or issues may arise. This assumes that you link to <front> is assigned the 0 key and also that 6 may be generated within the content paging, see below.

Custom paging - since the page content is broken down into smaller pieces for hand-held devices, this shows previous and next links and page totals.

Content broken down into manage pieces - A small hack has been implemented to split content into smaller chunks. This option can be disabled simply by deleting part of the PHP coding within node.tpl.php. If you do use this option however, there is a built in HTML corrector to try to solve any incorrect input.

Download Templates for Drupal v6x (tar) updated | Download Templates for Drupal v6x (zip) updated

Comments

missing (html tags) casuse page display error

sometimes the feed data are not 100% correct html, missing </br> </div> casuse page display error

Aware if the issue

I know that. As with the accessibility module itself the HTML needs to be valid XHTML or the page will break when viewing in Firefox for example.

I have tried to fix the HTML using the mobi_fix function in node.tpl.php - perhaps this should be looked at for page.tpl.php too?

I am not sure where the feeds are generated.

You can always override this by commenting out the drupal_set_header in template.php..

Sites that rely on user input, i.e. comments or feeds should disable the sending of content as application/vnd.wap.xhtml+xml unless you can really guarantee the validity of the XHTML.

HTH.

Jamie
Making Drupal Mobile

Hi Jamie, I tried blumobi

Hi Jamie,

I tried blumobi with Drupal 5.7 and it worked fine. However, when I tried bluemobi with Drupal 6.1 and got this error:

Fatal error: Call to undefined function: stripos() in /home/tpadelma/public_html/mobvox/themes/bluemobi/template.php on line 115

Do you have any suggestions on how to fix this? Thanks in advance.

You are using PHP 4x

Hi,

You need to either upgrade your PHP installation to PHP 5 or
add the function on this page stripos for php4 to your template.php file...

Br

Jamie
Making Drupal Mobile

Error in code

As John pointed out in a recent e-mail,
there is a slight error in the code in template.php
for this download.

On line 132, $newlinks should be changed to $new_links

This will be uploaded soon, however the script has evolved slightly over the weeks and I have,
I feel, a less convoluted way of achieve the same goal -

in this case adding accesskeys to $primary_links

Stay tuned

Br

Jamie
Making Drupal Mobile

Update

I am updating the whole theme, in particular template.php.
Should be available in a few days..

Br

Jamie
Making Drupal Mobile

Got array_merge_recursive() warning

Dear,

Using themes-v6 on Drupal v6, got such warning message:

* warning: array_merge_recursive() [function.array-merge-recursive]: Argument #1 is not an array in drupal/sites/all/themes/bluemobi/template.php on line 142.
* warning: array_merge_recursive() [function.array-merge-recursive]: Argument #2 is not an array in drupal/sites/all/themes/bluemobi/template.php on line 142.
* warning: Invalid argument supplied for foreach() in /drupal/sites/all/themes/bluemobi/template.php on line 145.

It is okay after comment out line 132 to 147.

Regards,
LiuJia

You can change it

It was pointed out by e-mail that there is an error in the template files.

A possible solution can be found here perhaps.

HTH.

Jamie
Making Drupal Mobile

Syndicate content