2015/04/22
ECCUBE2.11~
ECCUBEでカスタム追加した事例管理にコメントを追加する方法です。
1.DBにmain_comment2追加
2.LC_Page_Admin_Contents_Example_Ex.php 4個所にmain_comment2追加
/** * パラメーターの初期化を行う * @param Object $objFormParam */ function lfInitParam(&$objFormParam) { $objFormParam->addParam('example_id', 'example_id'); $objFormParam->addParam('事例タイトル', 'name', MTEXT_LEN, 'KVa', array('EXIST_CHECK','MAX_LENGTH_CHECK','SPTAB_CHECK')); $objFormParam->addParam('事例カテゴリ', 'category_id', INT_LEN, 'n', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('説明', 'main_comment', LTEXT_LEN, 'KVa', array('MAX_LENGTH_CHECK')); $objFormParam->addParam('説明2', 'main_comment2', LTEXT_LEN, 'KVa', array('MAX_LENGTH_CHECK')); $objFormParam->addParam('画像', 'main_image', LTEXT_LEN, 'KVa', array()); $objFormParam->addParam('ページタイトル', 'title', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('H1テキスト', 'h1', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('メタタグ:Keyword', 'keyword', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('メタタグ:Description', 'description', MTEXT_LEN, 'KVa', array('SPTAB_CHECK', 'MAX_LENGTH_CHECK')); $objFormParam->addParam('ランク移動', 'term', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK')); } function lfExampleInsert($arrPost,$member_id) { $objQuery = $objQuery =& SC_Query_Ex::getSingletonInstance(); // rankの最大+1を取得する $rank_max = $this->getRankMax(); $rank_max = $rank_max + 1; $table = 'dtb_example'; $sqlval = array(); $example_id = $objQuery->nextVal('dtb_example_example_id'); $sqlval['example_id'] = $example_id; $sqlval['category_id'] = $arrPost['category_id']; $sqlval['name'] = $arrPost['name']; $sqlval['main_comment'] = $arrPost['main_comment']; $sqlval['main_comment2'] = $arrPost['main_comment2']; $sqlval['main_image'] = $arrPost['main_image']; $sqlval['title'] = $arrPost['title']; $sqlval['h1'] = $arrPost['h1']; $sqlval['keyword'] = $arrPost['keyword']; $sqlval['description'] = $arrPost['description']; $sqlval['creator_id'] = $member_id; $sqlval['rank'] = $rank_max; $sqlval['create_date'] = 'CURRENT_TIMESTAMP'; $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; $objQuery->insert($table, $sqlval); } function lfExampleUpdate($arrPost,$member_id) { $objQuery = $objQuery =& SC_Query_Ex::getSingletonInstance(); $table = 'dtb_example'; $sqlval = array(); $sqlval['category_id'] = $arrPost['category_id']; $sqlval['name'] = $arrPost['name']; $sqlval['main_comment'] = $arrPost['main_comment']; $sqlval['main_comment2'] = $arrPost['main_comment2']; $sqlval['main_image'] = $arrPost['main_image']; $sqlval['title'] = $arrPost['title']; $sqlval['h1'] = $arrPost['h1']; $sqlval['keyword'] = $arrPost['keyword']; $sqlval['description'] = $arrPost['description']; $sqlval['creator_id'] = $member_id; $sqlval['update_date'] = 'CURRENT_TIMESTAMP'; $where = 'example_id = ?'; $arrValIn = array($arrPost['example_id']); $objQuery->update($table, $sqlval, $where, $arrValIn); } /** * 商品IDから記事を取得する。 * @param Integer id ID */ function getExampleByProductId($product_id = '') { $objProduct = new SC_Product_Ex(); $arrProduct = $objProduct->getDetail($product_id); if(count($arrProduct) > 0){ $arrExample = array(); $arrExample['name'] = $arrProduct['name']; $arrExample['main_list_comment'] = $arrProduct['main_list_comment']; $arrExample['main_comment'] = $arrProduct['main_comment']; $arrExample['main_comment2'] = $arrProduct['main_comment2']; $arrExample['main_image'] = $arrProduct['main_large_image']; $arrExample['title'] = $arrProduct['title']; $arrExample['h1'] = $arrProduct['h1']; $arrExample['keyword'] = $arrProduct['keyword']; $arrExample['description'] = $arrProduct['description']; } return $arrExample; }
3.管理フロント表示
/data/Smarty/templates/admin/contents/example.tpl
<tr> <th>説明2</th> <td> <label for="chk_bloc_html"><input type="checkbox" name="chk_main_comment2" id="chk_main_comment2" class="chk_html_editor" value="1" onclick="fckeditorCreate('main_comment2');" />HTMLエディターを使用する</label><br /> <!--{if $arrErr.main_comment2}--><span class="attention"><!--{$arrErr.main_comment2}--></span><!--{/if}--> <textarea id="main_comment2" name="main_comment2" cols="60" rows="8" wrap="soft" class="area60" maxlength="<!--{$smarty.const.LTEXT_LEN}-->" style="background-color:<!--{if $arrErr.main_comment2}--><!--{$smarty.const.ERR_COLOR|h}--><!--{/if}-->"><!--{"\n"}--><!--{$arrForm.main_comment2|h}--></textarea><br /> </td> </tr>
ゼヒトモ内でのプロフィール: ROCKSTREAM, ゼヒトモのホームページ作成・制作サービス, 仕事をお願いしたい依頼者と様々な「プロ」をつなぐサービス
2024/08/20
神社
御朱印
2024/07/06
神社
御朱印
2024/07/06
神社
御朱印
2024/02/09
神社
2024/02/09
神社