Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Drupalのモバイル用のテーマを入れる (その2)

mobiテーマ

[追記] 現在は、ブラウザのUAに応じたテーマの切り換えは、 SwitchTheme というモジュールを使っています。
[追記] さらに、SwithchThemeもやめて、Mobile Tools を使っています。

Accesibility モジュールを使ったモバイル用のテーマの導入はうまくいかなかったが、他にも方法はあるだろうと思い、もう少し探したところ、mobile theme というモジュールが見つかった。

このモジュールも、ブラウザの判定を行ってモバイルデバイスからのアクセスならばモバイル用のテーマに切り替える、という機能を持っている。ブラウザの判定のために、browscap というモジュールが必要である。

mobiテーマ
wapテーマ
wapテーマ
pdaテーマ
pdaテーマ

切り替えるモバイル用のテーマは適当なものを使えばよいらしい。mobileというテーマが紹介されていたのでこれを入れてみた。

mobile theme と同様な機能を持つモジュールとして、pda theme というモジュールも見つかった。ただし、こちらは drupal.org ではなく、Drupal日本語プロジェクトで配布されている。機能はmobile theme と大体同じである。

mobile themeはbrowscapを使ってブラウザデータベースを見て判断するというやや大げさな仕組みであるのに対して、pda themeはUser Agentから判定するコードが組み込まれている。日本製だけあって日本の携帯電話のブラウザの判定には十分そうだ。

pda theme モジュールと同時に pda というテーマも配布されているので、このテーマも試してみることにした。accesibility モジュールを試した時に入れた mobi と wap の2つのテーマも合わせて、どれがよいか試してみた。それぞれ、iモードHTMLシミュレータIIで取った画面を貼っておく。

切り替え用のモジュールは、mobile theme である。これのモバイル用テーマとして、mobi, wap, mobile, pda の4テーマを比べてみた。以下、おおまかな特徴である。

mobileテーマ
mobileテーマ
  • mobile: サイト名(トップへのリンク)の表示がないのでトップに行けない。先頭に”Skip to navigation”というリンクがでてナビゲーションメニューへ飛べる。各ノードのカテゴリー(taxonomy)を表示しない。コンテンツを表示した後に、サイドバーを表示する。Primary Linkメニューの表示がない。
  • mobi: サイト名表示あり。カテゴリー表示あり。サイドバーの表示なし。
  • wap: サイト名表示あり。カテゴリー表示なし。サイドバーの表示なし。Primary Linkメニューの表示あり。
  • pda: サイト名表示あり。カテゴリー表示あり。先にサイドバーの表示の後、コンテンツの表示。画像の表示なし。Primary Linkメニューの表示あり。

iモードHTMLシミュレータで見ると、どのテーマもscriptだのstyleだのiモードで使えないタグや属性を好き勝手に出している。どのテーマもiモード用に書いてあるわけではないので当然だ。本当は iモード用のテーマを作るのがよいのかもしれない。

結局、モバイル用のテーマとしては、mobile を採用し、先頭にサイト名(トップへのリンク)を表示するようにした。

これでとりあえずPCと同じURLで携帯からアクセスすることができる。ただし、iモードにはcookieが無いからセッション管理はできない。つまりログインはできない。

PAGE TOP