2024年4月19日(金) 14:06 JST

サイドボックスの追加方法

ZenCart

サイドボックスの追加方法

モジュール
includes/modules/sideboxes/sample_sb.phpを作成(他のページを複製内容を変更)

$title =  BOX_HEADING_SAMPLE_SIDEBOX;
$title_link = "sample_page";
//(1)テンプレートを使わない場合
//$content = '<div id="samplesbContent" class="sideBoxContent">サイドボックスのサンプルです</div>';
//(2)テンプレートを使う場合
require($template->get_template_dir('tpl_sample_sb_sidebox.php',
                                    DIR_WS_TEMPLATE, 
                                    $current_page_base,
                                    'sideboxes') . 
        '/tpl_sample_sb_sidebox.php');
require($template->get_template_dir($column_box_default, 
                                    DIR_WS_TEMPLATE, 
                                    $current_page_base,
                                    'common') . 
        '/' . $column_box_default);
?>

言語パック
includes/languages/japanese/extra_definitions/sample_sb.phpを作成(他のページを複製内容を変更)

<?php
/** 
 * LIST:5-11
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */

define('BOX_HEADING_SAMPLE_SIDEBOX', 'サンプル');
?>

テンプレート
includes/templates/template_default/sideboxes/tpl_sample_sb_sidebox.phpを作成(他のページを複製内容を変更)

<?php
/** 
 * LIST:5-13, LIST:6-2
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */

  $content  = '';
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
  $content .= 'サイドボックスのサンプルです<br />';
  if(CONFIG_SAMPLE_1 == 'true') {
    $content .= CONFIG_SAMPLE_2;
  }
  $content .= '</div>';
?>

以上で追加できる

※現在はEZ-Pagesがあるのでそこからページを増加したほうが