file_name = $file_name; $this->url = $url; $this->disp_name = $disp_name; // for title & breadcrumbs $this->lang_folder = $lang_folder; $this->parent = $parent; $this->children = $children; } } /* Relates parent Page & children Page array */ function link_relation($parent, $children) { $parent->children = $children; foreach ($children as $k => $v) $v->parent = $parent; } /* Gets Page object from Page_array by page_name */ function get_page_obj($page_name, $page_array) { foreach ($page_array as $k => $v) { if ($v->file_name == $page_name) return $v; else if ($v->children != NULL) { $obj = get_page_obj($page_name, $v->children); if ($obj != NULL) return $obj; } } return NULL; } /* Formats title string */ function format_title($curr_p) { if ($curr_p == NULL) return ""; else return format_title($curr_p->parent) . " :: " . $curr_p->disp_name; } /* Formats breadcrumb string for parent Pages */ function format_parent_breadcrumbs($parent_p) { if ($parent_p != NULL) return format_parent_breadcrumbs($parent_p->parent) . '' . $parent_p->disp_name . '>>'; else return ""; } /* Tests if curr_p is a descendant of p */ function is_descendant($curr_p, $p) { if ($curr_p == NULL) return false; else if ($curr_p->disp_name == $p->disp_name) return true; else return is_descendant($curr_p->parent, $p); } /* lang determination; var used throughout the site */ $lang = $_REQUEST["l"]; if ($lang != "ch") $lang = "en"; /* lang matrix allocation */ $lang_matrix = array("en" => array(), "ch" => array()); /* lang name */ $lang_matrix["en"]["lang"] = "English"; $lang_matrix["ch"]["lang"] = "中文"; /* site name */ $lang_matrix["en"]["site_name"] = "Global Quantum Academy"; $lang_matrix["ch"]["site_name"] = "環球量子醫學院"; /* webmaster */ $lang_matrix["en"]["webmaster"] = "Webmaster"; $lang_matrix["ch"]["webmaster"] = "網站管理員"; /* copyright */ $lang_matrix["en"]["copyright"] = "Copyright"; $lang_matrix["ch"]["copyright"] = "版權所有"; /* eng menu & pages */ $prefix = "?p="; $lang_matrix["en"]["menu"] = array(new Page("home", ".", "Home"), new Page("about", $prefix . "about", "About"), new Page("info", $prefix . "info", "Info"), new Page("link", $prefix . "link", "Link"), new Page("contact", $prefix . "contact", "Contact", false)); $lang_matrix["en"]["pages"] = $lang_matrix["en"]["menu"]; // $lang_matrix["en"]["pages"][] = new Page("discl", $prefix . "discl", "Disclaimer"); // $lang_matrix["en"]["pages"][] = new Page("sitemap", $prefix . "sitemap", "Sitemap", false); link_relation(get_page_obj("about", $lang_matrix["en"]["pages"]), array(new Page("GT", $prefix . "GT", "Dr. Gilbert KC Tay"), new Page("KT", $prefix . "KT", "Ken KW Tay"), new Page("RB", $prefix . "RB", "Rodney S Bhally"), new Page("PE", $prefix . "PE", "Paul Eastwood"))); // link_relation(get_page_obj("RB", $lang_matrix["en"]["pages"]), array(new Page("test", $prefix . "test", "Test", false))); /* chi menu & pages */ $prefix = "?l=ch&p="; $lang_matrix["ch"]["menu"] = array(new Page("home", "?l=ch", "首頁"), new Page("about", $prefix . "about", "關於我們"), new Page("info", $prefix . "info", "相關資訊"), new Page("link", $prefix . "link", "連結"), new Page("contact", $prefix . "contact", "聯絡我們", false)); $lang_matrix["ch"]["pages"] = $lang_matrix["ch"]["menu"]; // $lang_matrix["ch"]["pages"][] = new Page("discl", $prefix . "discl", "免責聲明"); // $lang_matrix["ch"]["pages"][] = new Page("sitemap", $prefix . "sitemap", "網站導覽", false); link_relation(get_page_obj("about", $lang_matrix["ch"]["pages"]), array(new Page("GT", $prefix . "GT", "鄭金春醫師"), new Page("KT", $prefix . "KT", "鄭慶瑋"))); // link_relation(get_page_obj("GT", $lang_matrix["ch"]["pages"]), array(new Page("test", $prefix . "test", "測試", false))); /* page determination; var used in index.php only */ $page = get_page_obj($_REQUEST["p"], $lang_matrix[$lang]["pages"]); if ($page == NULL) $page = get_page_obj("home", $lang_matrix[$lang]["pages"]); ?>
file_name == "contact") { ?> _
file_name != "home") { ?>