Re: Attribute Displayer の日付フォーマット
2015年3月29日 at 17:26
take34さん
かっこいいソースではありませんが、
<?php
global $c;
$ak = CollectionAttributeKey::getByID($akID);
if(is_a($attribute,'File')){
$f = File::getByID($attribute->fID);
$path = $f->getRelativePath();
echo '<img src="'.$path.'" alt=""/>';
}elseif($ak->akHandle == 'add_date'){
echo date('Y/m/d',strtotime($attribute));
}else{
echo $attribute;
}
?>
$ak->akHandleで比較しているのは、追加したページ属性のハンドル名を指定しています。
controller.php側ともう少しうまく連携できたら、スマートにコードが書けるかも・・・
Your post has been saved and will be published after approval by the forum moderator.
anken
Re: Attribute Displayer の日付フォーマット
ご返信ありがとうございます!
無事表示する事ができました!
助かりました、ありがとうございました!