/*************Smarty*****************/
/*Load file class Smarty*/
require '../photogallary/config/config.php';
require_once( '../common/getauthorid.php' );
require CLS_PATH.'/sql_photogallary.php';
#$author_name = getAuthorName();
$author_name = 'sapporo-med';
$authornickname = getAuthorNickName($author_name);
$nGallaryPerPage = 5; // so Gallary tren 1 trang
$p = 1; // mac dinh lay 5 ket qua dau tien
if(isset($_GET['page'])) $p = $_GET['page'];
$start = ($p-1)*$nGallaryPerPage;
$author_id = getAuthorID($author_name);
$total = numOfGallary($author_id);
$nPage = ceil($total/$nGallaryPerPage);
$sPage = '';
if ($nPage>1){
for ($j=0;$j<$nPage;$j++){
if(($j+1) == $p){
$sPage .= ''.($j+1).' ';
}
else{
$sPage .= ''.($j+1).' ';
}
}
}
$currentPage = $p;
$maxPage = $nPage;
$myphotos = getPhotosByAuthorLimit($author_id,$start,$nGallaryPerPage);
// title tag 2014/6/18
$titletag = '';
if($p > 1) {
$titletag = $p.'ページ目|';
}
$arrData['UserNickname'] = $authornickname;
$arrData['UserName'] = $author_name;
$strUserCategory = ereg_replace('[a-zA-Z]*-', '', $arrData['UserName']);
$strUserPref = ereg_replace('-[a-zA-Z]*', '', $arrData['UserName']);
$smarty->assign( 'arrData', $arrData );
$smarty->assign( 'UserCategory', $strUserCategory );
$smarty->assign( 'UserPref', $strUserPref );
$smarty->assign( 'sPage', $sPage );
$smarty->assign( 'myphotos', $myphotos );
$smarty->assign( 'currentPage', $currentPage );
$smarty->assign( 'maxPage', $maxPage );
$smarty->assign( 'titletag', $titletag ); // 2014/6/18
$smarty->display( 'photogallary/CMS_PHOTO_main.tpl' );
?>