"HTMLでValidateするフォームメール" という記事を何回か連続で書いてきましたが、この意味がなかなか判りづらいかもしれません。「POSTデータ処理を行うための基準を、HTMLフォームそのものに求める」と書いても、判らない人には判らないでしょう。
というわけで、もう少し判りやすい実例で行きましょう。
その1
「商品説明コンテンツに、共通の問い合わせフォームを埋め込む」
picoを使ってカテゴリーごとに商品ページを作ったとしましょう。それらの一つ一つに、問い合わせフォームを埋め込んでいくなんて、それこそナンセンスです。
こんな用途では、formmailプラグインとpicoプラグインの組み合わせでバッチリです。
商品説明ページはこんな感じで作ります。(SmartyフィルターをONにすること)
(商品説明部分)
<{capture}>
<{pico id="(フォームを記述したコンテンツ番号)"}>
<{/capture}>
<{formmail4fleamarket mail_body_pre="以下の商品について問い合わせがありました。\nいずれかの連絡先までご連絡ください。\n\n" from_name="商品問い合わせ担当" cc_field_name="youremail" cc_mail_subject="確認メール" cc_mail_body_pre="お問い合わせありがとうございました。\n以下が確認内容です。\n"}>
<form>
お名前: <input type="text" name="お名前" class="required" /><br />
email: <input type="text" name="youremail" class="email" />
<input type="submit" />
</form>
And as usual i start to put my self in troubles
changing "formmail4fleamarket" to "formvalidation"
I had to go through phpmyadmin to fix smarty bug..
function smarty_function_formmail( $params , &$smarty )
{
$controller =& new PicoFormProcessBySmartyFormmail() ;
$controller->parseParameters( $params ) ;
// toEmails from 'adminmail'
if( empty( $controller->toEmails ) ) {
if( trim( $GLOBALS['xoopsConfig']['adminmail'] ) != '' ) {
$controller->toEmails[] = $GLOBALS['xoopsConfig']['adminmail'] ;
}
}
$controller->execute( $params , $smarty ) ;
}
class PicoFormProcessBySmartyFormmail extends PicoFormProcessBySmartyBase
{
function __construct()
{
$this->mypluginname = 'formmail' ;
}
function executeLast()
{
$this->sendMail() ;
}
}