ステップ2: 登録フォームを作成する言語ファイルの作成memo/language/japanese/main.ini
[memo_View_Edit_Init]
memo_content="本文"
コンポーネントの作成memo/view/main/init/Init.class.php からコピーして、
コンポーネント(共通プログラム)を作成する
memo/components/View.class.php
function getRecord( $block_id )
{
// データベースからの読み出し
$records =& $this->_db->selectExecute(
"memo",
array( "block_id" => $block_id )
);
// レコードの配列から、最初のレコードを指定する
if ( isset( $records[0] ) ) {
return $records[0];
}
// レコードがなければ、null を返す
return null;
}
view プログラムの作成memo/view/main/init/Init.class.php
memo/view/edit/init/Init.class.php
var $memo_record = null;
function execute()
{
// データベースからの読み出し
$this->memo_record = $this->memoView->getRecord( $this->block_id );
return 'success';
}
テンプレートの作成「決定」ボタンがクリックされると、enterContent が実行される。
memo/templates/default/memo_view_edit_init.html
<div class="outerdiv">
<form id="memoForm<{$id}>" action="#" onsubmit="return false;">
<{* 呼び出すアクション *}>
<input type="hidden" name="action" value="memo_action_edit_init" />
<table class="outer" summary="<{$smarty.const._SUMMARY_SETTINGFORM}>">
<{* 本文 *}>
<tr class="row">
<th class="nowrap" scope="row">
<label for="memo_content<{$id}>">
<{$lang.memo_content|smarty:nodefaults}>
</label>
</th>
</tr>
<tr class="row">
<td class="nowrap">
<{* 本文 入力 *}>
<textarea id="memo_content<{$id}>" class="textarea" name="content"><{$action.memo_record.content}></textarea>
</td>
</tr>
<{* 本文 終わり *}>
</table>
<div class="btn-bottom">
<{* 決定 ボタン *}>
<input class="btn-width lined_btn" type="button" value="<{$lang._regist|smarty:nodefaults}>" onclick="memoCls['<{$id}>'].enterContent(this.form);" />
<{* キャンセル ボタン *}>
<input class="btn-width lined_btn" type="button" value="<{$lang._cancel|smarty:nodefaults}>" onclick="commonCls.removeBlock('<{$id}>'); return false;">
</div>
</form>
</div>
注意: 半角|が入力できなかったので、代わりに全角|で表示している
モジュールをアップデートする