commit 5ad6e0e9059d8ea04d50cc763ee3637a5ddbe0f4 parent f96117d80fc9ff81b7b6c9df8c0adf0c8317a041 Author: Overseer <overseer@mona.qualityreto.net> Date: Sat, 24 Feb 2018 00:45:10 -0600 Move building the navbar from header.php to functions.php Diffstat:
functions.php | | | 10 | ++++++++++ |
header.php | | | 7 | +------ |
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/functions.php b/functions.php @@ -68,4 +68,14 @@ function post_list() { } +function build_nav() { + + $nav = "<ul class=\"nav\">\n"; + foreach( $pages as $thisPage ) { + #$nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "/page/" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; + $nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "index.php?page=" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; + } + $nav .= "</ul>"; +} + ?> diff --git a/header.php b/header.php @@ -1,10 +1,5 @@ <?php -$nav = "<ul class=\"nav\">\n"; -foreach( $pages as $thisPage ) { - #$nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "/page/" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; - $nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "index.php?page=" . link_name( $thisPage ) . "\">" . format_name( $thisPage ) . "</a></li>\n"; -} -$nav .= "</ul>"; +build_nav(); $title = "Just a Blog!"; if( isset( $_GET['page'] ) ) {