<?php

date_default_timezone_set('Asia/Tokyo');

/*  */
$name = "hotel_staff";
$relativeRootPath = "../";
$relativePortalRootPath = "../../";
$libDirName = "lib/";

require_once $relativeRootPath.$libDirName.'config.php';
require_once $relativeRootPath.$libDirName.'lib.php';
require_once $relativeRootPath.'smarty/Smarty.class.php';

$sceneNode = $configXML->xpath('//scene[@name="'.$name.'"]');
$parentSceneNode = $sceneNode[0]->xpath('parent::node()');
$nameExt = $sceneNode[0]["name-ext"];
$ogURLFix = "/";
if($nameExt){
	$ogURLFix = $nameExt;
}

/* redirect */
$deviceType = getDeviceType();
if($deviceType === "sp"){
	header('Location: '.$relativeRootPath.'sp/'.$parentSceneNode[0]['name']."/".$name.".html", true, 302);
	eixt();
}

/* display template */
// $title = $configXML->xpath('//scene[@name="'.$name.'"]/@title');
// $description = $configXML->xpath('//scene[@name="'.$name.'"]/description/text()');
$ref = array(
	"title" => $sceneNode[0]["title"],
	"description" => $sceneNode[0]->description,
	"keywords" => $config["base_keywords"].$sceneNode[0]->keywords,
	"accessURL" => $config["access_url"],
	"baseURL" => $config["base_url"],
	"og_site_title" => $config["og_site_title"],
	"og_type" => "article",
	"og_url" => $config["og_root_url"].$parentSceneNode[0]['name']."/".$name.$ogURLFix,
	"og_image" => $config["og_root_url"].$parentSceneNode[0]['name']."/images/character_".$name."_large.png",
	"root_url" => $config["root_url"],
	"relative_root_path" => $relativeRootPath,
	"relative_portal_root_path" => $relativePortalRootPath,
	"version" => $config["app_ver"],
	"device" => $deviceType,
	"body_tpl_name" => $name.".tpl",
	"page_name" => "character"
);

$smarty = new Smarty();
$smarty->template_dir = $relativeRootPath.'templates/';
$smarty->compile_dir = $relativeRootPath.'templates_c/';
$smarty->config_dir = $relativeRootPath.'configs/';
$smarty->cache_dir = $relativeRootPath.'cache/';

//$smarty->caching = true;

$smarty->assign($ref);
$smarty->display($config["base_tpl_name"]);

?>
