Get Smarty

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Check reviews of PHP Web Hosting, compatible with Smarty Templates

WAP/WML

WAP/WML テンプレートはテンプレートコンテンツに加え、php によって Content-Type ヘッダ が渡される必要があります。これを実行する容易な方法は、 ヘッダを出力するカスタム関数を記述する事です。 もし キャッシュ を有効にしている場合はキャッシュは機能しないので、 {insert} タグを用いて出力を行います ({insert} タグはキャッシュされない事を覚えていて下さい)。 もしテンプレートの前にブラウザに何か出力されていると、 ヘッダの出力は失敗する可能性があります。

Example 18.6. WML Content-Type ヘッダを出力するために {insert} を使用する


<?php

// apache で拡張子.wml の設定がされている事を確認して下さい!
// この関数をアプリケーション内あるいは Smarty.addons.php で定義します
function insert_header($params)
{
   // この関数は、パラメータ $content を期待します
   if (empty($params['content'])) {
       return;
   }
   header($params['content']);
   return;
}

?>

    

Smarty テンプレートは、次のように insert タグから始まる必要があります。


{insert name=header content="Content-Type: text/vnd.wap.wml"}

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">

<!-- 新しい wml のデッキ -->
<wml>
 <!-- 最初のカード -->
 <card>
  <do type="accept">
   <go href="#two"/>
  </do>
  <p>
   Smarty 版の WAP へようこそ!
   OK を押すと次に進みます……
  </p>
 </card>
 <!-- 二枚目のカード -->
 <card id="two">
  <p>
   どう?簡単でしょ?
  </p>
 </card>
</wml>

    

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 4 plus 9? (Are you human?)

Sponsors [info]

Cheap Website Hosting @hostdone.com
email marketing @ActiveCampaign
broadband deals @BroadbandGenie
Best UK Web Hosting @webhost.uk.net
Reliable UK and US Web Hosting @rshosting.com
Cheap US and UK Web Hosting @infrenion.com
I.T Certification Exams @pass-guaranteed.com
Certification Practice Tests @firsttrycertify.com
Certification Practice Exam Questions @ace-it-certifications.com
Broadband Speed Test @broadbandspeed.co.uk
bulk email software @americaint.com
ASP.NET hosting @aspnethosting.co.uk