Archive for 12月, 2007

php5風エラー処理

12月 14th, 2007

php5風エラー処理。
返り値に配列が入れば便利だと思うんだけどなー。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class model{
 function hoge(){
  //エラー発生
  throw new exception('エラー内容')
 }
}
 
try{
 $model= new model();
 $data=$model->hoge();
}
catch( exception $e ){
 $error = $e->getMessage();
}

smarty関数html_select_date

12月 12th, 2007

初期状態をemptyにする方法

色々適当に設定してたら発見。

{html_select_date
 field_array="postege_day"
 time="--"
 year_empty="選択"
 month_empty="選択"
 day_empty="選択"
 prefix=""
 month_format="%m"
 field_order="YMD"
 end_year="+1"
 field_separator=" / "
}

なぜ–でいけるのか不明。
ソースを解読したほうが早かったのかな・・