'Home', 'resume.php' => 'Resume', 'courses.php' => 'Courses', 'courses2.php' => 'Courses' ); /* ----------------------------------------------------------------------- This creates a web page given the page_name and content. The side_menu and aside_content are optional IMPORTANT NOTE: This function is called differently than the one you made in lab You specify the php file name, which is then used to lookup the page name and content file name Example: make_page(resume.php, side_menu.html, aside_content.hml, ''); ----------------------------------------------------------------------- */ function make_page($file_name, $side_menu=null, $aside_content=null, $style=null) { // Use the global variables for website_name, author and pages global $website_name; global $author; global $pages; // Use the file name to look up the page name $page_name = $pages[$file_name]; // Use the file name (e.g., resume.php) to determine the content file name (e.g., resume.html) $page_content = str_replace('.php', '.html', $file_name); // Generate the the navbar menu $navbar = make_navbar($page_name); // Generate the footer content $footer = make_footer($author); /* The main container can have four different configuration depending on whether or not side_menu or aside_content are present The string $main_content will contain one of the four configurations */ // If both side_menu and aside are present if ($side_menu && $aside_content) { $main_content = '
'.file_get_contents($page_content).'
'; } else if ($side_menu) { // Side menu only $main_content = '
'.file_get_contents($page_content).'
'; } else if ($aside_content) { // Aside only $main_content = '
'.file_get_contents($page_content).'
'; } else { // No side menu and no aside $main_content = '
'.file_get_contents($page_content).'
'; } /* This is the actual echoed output of this function All the other code creates strings that are not echoed. */ echo ' '.$website_name.' - '.$page_name.' '.$style.'
'.$navbar.'
'.$main_content.'
'; } /* ----------------------------------------------------------------------- This creates the nav menu ----------------------------------------------------------------------- */ function make_navbar($active_page) { global $pages; $menu = ''; foreach ( $pages as $link => $name ) { $active = ''; if ($active_page == $name) $active = 'active'; $menu .= ''.$name.''; } return ' '; } /* ----------------------------------------------------------------------- This creates the page footer with links at bottom Note that this is intentially different than make_navbar so you can see two different ways to compose and return a string make_navbar slices in the the menu string variable make_footer concatenates the list items in between the ul and /lu tags ----------------------------------------------------------------------- */ function make_footer() { global $pages; global $author; $output = ' '; return $output; } ?>