|
1: 2008-06-23 (月) 23:32:59 nao-pon |
| + | * 携帯対応レンダー [#c558a62d] |
| | | |
| + | HypCommonPreLoad に含まれる出力フィルターで、携帯端末でアクセスできる状態で出力します。 |
| + | |
| + | ** XOOPS のテーマ調整 [#pd3b0a9d] |
| + | |
| + | 使用する XOOPS の theme が DIVレイアウトの場合は、そのままでもある程度、携帯で見やすい形で表示されますが、TABLE レイアウトの theme では、コンテンツ部分を先に表示したりと、HTMLの再構成をしないと、実用的でない場合があります。 |
| + | |
| + | HTML の再構成をする場合は、携帯対応レンダーが適切に部分抽出できるように、簡単なタグを仕込む必要があります。 |
| + | |
| + | 使用できるタグは、設定項目にある「HTML再構築用タグ設定」のキーワードを利用したタグなります。規定値では、次のタグが使えます。 |
| + | |
| + | |~開始タグ|~終了タグ|h |
| + | | <!--headerlogo--> | <!--/headerlogo--> | |
| + | | <!--headerbar--> | <!--/headerbar--> | |
| + | | <!--breadcrumbs--> | <!--/breadcrumbs--> | |
| + | | <!--leftcolumn--> | <!--/leftcolumn--> | |
| + | | <!--centerCcolumn--> | <!--/centerCcolumn--> | |
| + | | <!--centerLcolumn--> | <!--/centerLcolumn--> | |
| + | | <!--centerRcolumn--> | <!--/centerRcolumn--> | |
| + | | <!--content--> | <!--/content--> | |
| + | | <!--rightcolumn--> | <!--/rightcolumn--> | |
| + | | <!--footerbar--> | <!--/footerbar--> | |
| + | |
| + | それぞれのタグで囲まれた範囲が、XOOPS_TRUST_PATH/class/Hyp_common/ktairender/templates/default ディレクトリ内にある |
| + | |
| + | - header.html [ページヘッダ] |
| + | - body.html [コンテンツ部分(必要に応じて分割され、ページナビゲーションが付加されます)] |
| + | - footer.html [ページフッタ] |
| + | |
| + | 各ファイルの該当キーワードタグと置換され、「HTML再構築用タグ設定」の 各キーの 'above' の内容が前方に、'below' の内容が後方に挿入されます。 |
| + | |
| + | 例えば、XOOPS Cube Legasy の "cube_default" テーマにおいて、"leftcolumn" を設定する場合は、theme.html に、次のような箇所があると思います |
| + | |
| + | #code(html,nonumber){{ |
| + | <{if $xoops_showlblock == 1}> |
| + | <td id="leftcolumn" class="leftcolumn"> |
| + | <!-- Start left blocks loop --> |
| + | <{foreach item=block from=$xoops_lblocks}> |
| + | <div class="leftblockTitle"><{$block.title}></div> |
| + | <div class="leftblockContent"><{$block.content}></div> |
| + | <{/foreach}> |
| + | <!-- End left blocks loop --> |
| + | </td> |
| + | <{/if}> |
| + | }} |
| + | |
| + | これを次のようにします。 |
| + | |
| + | #code(html,nonumber){{ |
| + | <{if $xoops_showlblock == 1}> |
| + | <td id="leftcolumn" class="leftcolumn"> |
| + | <!-- Start left blocks loop --> |
| + | <!--leftcolumn--> |
| + | <{foreach item=block from=$xoops_lblocks}> |
| + | <div class="leftblockTitle"><{$block.title}></div> |
| + | <div class="leftblockContent"><{$block.content}></div> |
| + | <{/foreach}> |
| + | <!--/leftcolumn--> |
| + | <!-- End left blocks loop --> |
| + | </td> |
| + | <{/if}> |
| + | }} |
| + | |
| + | 注意すべき点は、<{foreach ... }> 〜 <{/foreach}> を崩さないようにすることです。 |
| + | |
| + | また、携帯対応レンダーを使っている場合は、Smarty変数の $smarty.const.HYP_K_TAI_RENDER が TRUE になりますので、この値で、場合分けができます。 |
| + | |
| + | このようにして、携帯対応レンダー用タグを仕込んだ "cube_default" テーマの theme.html が &ref(theme.html); です。参考にお使いください。 |
| + | |
| + | #code(theme.html) |
| + | |
| + | ** 設定 (hyp_preload.conf.php) [#gacdaf31] |
| + | |
| + | "XOOPS_TRUST_PATH/class/hyp_common/preload/hyp_preload.conf.php" を編集して設定をします。該当ファイルがない場合は、同じディレクトリに含まれている "hyp_preload.conf.php.rename" をリネームしてください。 |
| + | |
| + | - hyp_preload.conf.php 内の携帯対応レンダー関連の設定項目 |
| + | #code(php,nonumber){{ |
| + | // 各機能のメインスイッチ (On = 1, Off = 0) |
| + | $this->use_k_tai_render = 0; // 携帯対応レンダーを有効にする |
| + | |
| + | ///////////////////////// |
| + | // 携帯対応レンダー設定 |
| + | |
| + | // 携帯端末判定用 UA 正規表現 |
| + | $this->k_tai_conf['ua_regex'] = '#(?:SoftBank|Vodafone|J-PHONE|DoCoMo|UP\.Browser)#'; |
| + | |
| + | // HTML再構築用タグ設定 |
| + | $this->k_tai_conf['rebuilds'] = array( |
| + | 'headerlogo' => array( 'above' => '<center>', |
| + | 'below' => '</center>'), |
| + | 'headerbar' => array( 'above' => '<hr>', |
| + | 'below' => ''), |
| + | 'breadcrumbs' => array( 'above' => '', |
| + | 'below' => ''), |
| + | 'leftcolumn' => array( 'above' => '<hr>', |
| + | 'below' => ''), |
| + | 'centerCcolumn' => array( 'above' => '<hr>', |
| + | 'below' => ''), |
| + | 'centerLcolumn' => array( 'above' => '', |
| + | 'below' => ''), |
| + | 'centerRcolumn' => array( 'above' => '', |
| + | 'below' => ''), |
| + | 'content' => array( 'above' => '<hr>', |
| + | 'below' => ''), |
| + | 'rightcolumn' => array( 'above' => '<hr>', |
| + | 'below' => ''), |
| + | 'footerbar' => array( 'above' => '', |
| + | 'below' => ''), |
| + | 'easylogin' => array( 'above' => '<div style="text-align:center;font-size:0.9em">[ ', |
| + | 'below' => ' ]</div>'), |
| + | ); |
| + | |
| + | // 使用テンプレート |
| + | $this->k_tai_conf['template'] = 'default'; |
| + | |
| + | // インラインイメージを表示するホスト名(後方一致) |
| + | $this->k_tai_conf['showImgHosts'] = array('amazon.com', 'yimg.jp', 'yimg.com'); |
| + | |
| + | // リダイレクトスクリプトを経由しないホスト名(後方一致) |
| + | $this->k_tai_conf['directLinkHosts'] = array('amazon.co.jp'); |
| + | |
| + | // 外部リンク用リダイレクトスクリプト |
| + | $this->k_tai_conf['redirect'] = XOOPS_URL . '/class/hyp_common/redirect.php?l='; |
| + | |
| + | // Easy login を有効にする |
| + | $this->k_tai_conf['easyLogin'] = 1; |
| + | // Easy login で IP アドレス帯域をチェックしない |
| + | $this->k_tai_conf['noCheckIpRange'] = 0; |
| + | // リンクメッセージ |
| + | $this->k_tai_conf['msg']['easylogin'] = '簡単ログイン'; |
| + | $this->k_tai_conf['msg']['logout'] = 'ログアウト'; |
| + | |
| + | // 携帯対応レンダー設定 以上 |
| + | ///////////////////////////// |
| + | }} |