(1)データベース(dtb_products)にカラムを追加
ALTER TABLE dtb_products ADD youtube text
(2)パラメータ設定で、表示サイズを指定できるようにする。
① データベースへの挿入(mtb_constants)
INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('YOUTUBE_WIDTH', '260', 1414, 'YouTube動画の横幅');
INSERT INTO mtb_constants (id, name, rank, remarks) VALUES ('YOUTUBE_HEIGHT', '195', 1415, 'YouTube動画の高さ');
② パラメータ設定を開き、「この内容で登録する」ボタンをクリックする。(下図のように表示される)
(3)ファイルに追加
■data/class/pages/admin/products/LC_Page_Admin_Products_Product.php(3カ所)
① function lfInitFormParam(&$objFormParam, $arrPost)内の「$objFormParam->addParam(“メーカーURL”・・・」の次に
$objFormParam->addParam("YouTube動画", "youtube", STEXT_LEN, 'KVna', array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); // ■youtube ①/③
② 986行目あたりの「// 配列の添字を定義」の箇所
'sale_limit', 'deliv_date_id', 'maker_id', 'note'); ↓(変更) 'sale_limit', 'deliv_date_id', 'maker_id', 'note', 'youtube'); // ■youtube ②/③ 1 <span style="color: #0000ff;">③</span> 上記の下「// INSERTする値を作成する。」の箇所 $sqlval['creator_id'] = $_SESSION['member_id'];の次に 1 $sqlval['youtube'] = $arrList['youtube']; // ■youtube ③/③
■data/Smarty/templates/admin/products/product.tpl 「メーカーURL」の行の下に追加
<tr> <th>YouTube動画URL</th> <td> <span class="attention"><!--{$arrErr.youtube}--></span> <div style="font-size:12px; line-height:1.5em;"> ① YouTubeにアクセスします。 <a href="http://www.youtube.com/" target="_blank">http://www.youtube.com/</a><br /> ② 目的の動画のページを開きます。<br /> ③ 下に示すように,アドレスバーのURLから<font color="#FF0000">xxxxxxxxxxx</font>の箇所だけをコピーして貼り付けます。<br /> http://www.youtube.com/watch?v=<font color="#FF0000">xxxxxxxxxxx</font>&feature=g-vrec<br /> <span style="color: #909;">入力例) oVHzyiD8d6o</span> </div> <span class="attention"><!--{$arrErr.youtube}--></span> <input type="text" name="youtube" value="<!--{$arrForm.youtube|h}-->" size="60" class="box60" style="<!--{$arrErr.youtube|sfGetErrorColor}-->" /> </td> </tr>
■data/Smarty/templates/admin/products/confirm.tpl 「メーカーURL」の行の下に追加
<!--▼YouTube▼--> <tr> <th>YouTube動画</th> <td> <!--{if $arrForm.youtube}--> <iframe width="<!--{$smarty.const.YOUTUBE_WIDTH}-->" height="<!--{$smarty.const.YOUTUBE_HEIGHT}-->" src="http://www.youtube.com/embed/<!--{$arrForm.youtube|h}-->?wmode=transparent" frameborder="0" allowfullscreen></iframe> <!--{/if}--> </td> </tr> <!--▲YouTube▲-->
■class/SC_Product.php 621行目あたり、「,dtb_products.note」の次に追加
,dtb_products.youtube
■data/Smarty/templates/default/products/detail.tpl
・・・画像を拡大するの次へ挿入。
<!--▼YouTube▼--> <!--{if $arrProduct.youtube}--> <div id="youtube"> <iframe width="<!--{$smarty.const.YOUTUBE_WIDTH}-->" height="<!--{$smarty.const.YOUTUBE_HEIGHT}-->" src="http://www.youtube.com/embed/<!--{$arrProduct.youtube|h}-->?wmode=transparent" frameborder="0" allowfullscreen></iframe> </div> <!--{/if}--> <!--▲YouTube▲-->