#!D:/Perl/bin/Perl -I D:/Inetpub/wwwroot/demi/html/cgi-bin

use strict;
use CGI::Session;
use CGI::Session qw/-ip_match/; 
use CGI qw(-no_xhtml :standard :cgi);
use CGI::Carp qw(fatalsToBrowser set_message);
use HTML::Template;

use DemiConf;
use DemiUtil;
use StringUtil;
use TopicsModel;
use TopicsCategoryModel;

BEGIN {
	use File::Basename;
	chdir dirname($0);	
}

# カテゴリが「商品リリース」の記事のみ抽出
my $CATEGORY_CD1 = getProductsCategoryId();

# テンプレート
my @template_buf = openTemplate('./products_list.html');
my $template = HTML::Template->new(die_on_bad_params => 0, arrayref=>\@template_buf);


my @ary_topics_list = TopicsModel::excuteRelationList($CATEGORY_CD1, "0");


# テンプレート用の値
my $ary_topics_list_flag = ($#ary_topics_list == -1) ? undef : '1';

# テンプレートに値をセット
$template->param(ary_topics_list => \@ary_topics_list);
$template->param(ary_topics_list_flag => $ary_topics_list_flag);


print "Content-Type: text/html;charset=Shift_jis\n\n";

print $template->output;