星期二, 6月 30, 2009

Xataface-製作動態選單

在Xataface中設定動態選單(雙層選單)並不困難,這裡示範的是單一資料表方式,也可將第一層和第二層選單分開存在兩個資料表(areas)。








province_idcity_idname
U01U0100province_1
U01U0101city_1
U01U0102city_2
U02U0200province_2
U02U0201city_3
U02U0202city_4

1.修改valuelists.ini
[cities]
__sql__ = "select city_id, name, province_id from areas order by city_id"
[provinces]
__sql__ = "select province_id,province_name from areas where SUBSTR(city_id,4,2)="00" order by province_id"


2.修改fields.ini
[province]
vocabulary=provinces
[city]
vocabulary=cities


3.修改應用程式目錄/tables/tablename.php
class tables_tablename {
http://xataface.com/wiki/index.php?-table=wiki&-action=browse&page_id=%3D90
} //End of class

沒有留言: