1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
| <?php
function display_header($sxml)
{
$page_active = basename($_SERVER['PHP_SELF']); // current page
$folder_active = str_replace("-", "_", array_pop(explode("/", dirname($_SERVER['PHP_SELF'])))); // current folder
/******* constuction of the menu and sub-menu *********/
$menu = array(
'home' => array( // element id => sub-menu element array
'index',
'contact_us',
'site_map',
'faq'
),
'about_us' => array(
'mission',
'statutory_bodies',
'member_countries',
'iir_members',
'commissions',
'working_parties'
),
...
);
$header = "<img src='/new/img/logo_printable.png' id='logo_printable' width='513' height='60' alt='".$sxml->name_short." - ".$sxml->name."'>\n";
$header .= "<ul id='lang'>\n";
$header .= " <li><h2>".$sxml->french_fr."</h2></li>\n";
$header .= " <li><h3><a href='javascript:;' title='".$sxml->english_site."' class='link_green'>".$sxml->english_en."</a></h3></li>\n";
$header .= "</ul>\n";
$header .= "<div id='menu1'>";
$header .= "<ul id='menu_main'>\n";
foreach($menu as $k => $val)
{
$cls = ($k == $folder_active) ? "class='active'" : "";
$header .= " <li $cls><a href='/new/".str_replace("_", "-", $k)."/".str_replace("_", "-", $val[0]).".php'>".$sxml->$k."</a></li>\n";
}
$header .= "</ul>\n";
$header .= "<div class='header_search'><form name='form_search' action='' method='post'><input name='kw' type='text' maxlength='30' value='".$sxml->quick_search."' class='search'></form></div>\n";
$header .= "</div>\n";
$header .= "<div id='menu2'>";
$header .= "<ul id='menu_sub'>\n";
foreach($menu[$folder_active] as $val)
{
$header .= " <li><a href='/new/".str_replace("_", "-", $k)."/".str_replace("_", "-", $val).".php'>".$sxml->$val."</a></li>\n";
}
$header .= "</ul>\n";
$header .= "</div>\n";
return $header;
} |
Partager