<?php

$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;

// 記事が存在しない場合
if( !D3news::isPublishedExists( $mydirname , $storyid) ){
	redirect_header($mydirurl.'/index.php',2,_MD_NOSTORY);
	exit();
}

// require_once XOOPS_ROOT_PATH.'/class/template.php';

$article = new D3news( $mydirname , $storyid);

$datetime = formatTimestamp($article->getVar('published'), $d3news_date_format);

$tpl = new icms_view_Tpl();
$tpl->templated_dir = XOOPS_ROOT_PATH.'/themes';
//$tpl->xoops_setCaching(2);
//$tpl->xoops_setCacheTime(0);
$tpl->caching = 0;;

$tpl->assign('charset', _CHARSET);
$tpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
$tpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
$tpl->assign('slogan', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
$tpl->assign('xoops_version', htmlspecialchars(XOOPS_VERSION, ENT_QUOTES));
$tpl->assign('site_image', htmlspecialchars($d3news_imgurl_on_print, ENT_QUOTES));
$tpl->assign('story_title', $article->getVar('title'));
$tpl->assign('story_date', $datetime);
$tpl->assign('story_topic', $article->topic_title());
$tpl->assign('story_hometext', $article->getVar('hometext'));

$myimage = $article->getVar('image');
if($myimage){
	$myimgurl = XOOPS_URL . "/uploads/d3news/" . $myimage;
}
$tpl->assign('story_titleimg', $myimgurl);


$tpl->assign('story_id', $storyid);
$tpl->assign('story_bodytext', $article->getDividedBodytext());
$tpl->assign('this_comes_from', sprintf(_MD_THISCOMESFROM,htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
$tpl->assign($assing_array);

$tpl->display( "db:{$mydirname}_print.html" ) ;

?>
