我有一个更灵活的程序来显示一次活动的“日期”。
if($event[ Event ][ is_multi_day ]){
if( date( n ,strtotime($event[ Event ][ start_day ]) ) == date( n ,strtotime($event[ Event ][ end_day ])) )
$date = date( j ,strtotime($event[ Event ][ start_day ])). - .
date( j ,strtotime($event[ Event ][ end_day ])). .
date( M ,strtotime($event[ Event ][ end_day ]));
else
$date = date( j ,strtotime($event[ Event ][ start_day ])). .
date( M ,strtotime($event[ Event ][ start_day ])). - .
date( j ,strtotime($event[ Event ][ end_day ])). .
date( M ,strtotime($event[ Event ][ end_day ]));
}else{
$date = date( j M , strtotime($event[ Event ][ start_day ]));
}
I have to include that code block in every page I display an event. How do I define a function for this, which can be called from views I want?