FijiVirtual Posted June 23, 2016 Report Share Posted June 23, 2016 Hey! I would like some help here on how to hide the entire navigation bar and footer to unregistered members. Here's my code so far: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="shortcut icon" href="assets/ico/favicon.ico"> <title> <?php echo $page_title ?> </title> <!-- Stylesheets --> <link href="<?php echo SITE_URL?>/lib/skins/fijivirtual/css/font-awesome.css" rel="stylesheet" media="all" /> <link href="<?php echo SITE_URL?>/lib/skins/fijivirtual/css/theme.css" rel="stylesheet" media="all" /> <!-- Just for debugging purposes. Don't actually copy this line! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <?php echo $page_htmlhead;?> </head> <body> <?php /* This should be the first thing you place after a <body> tag This is also required by phpVMS */ echo $page_htmlreq; ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/smoothscroll/1.4.4/SmoothScroll.min.js"></script> <script src="assets/js/modernizr.js"></script> </head> <body> <?php /* Quick example of how to see if they're logged in or not Only show this login form if they're logged in */ if(Auth::LoggedIn() == false) { ?> <!-- Fixed navbar <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="//fijivirtual.xyz/index.html"><img src="http://i.imgur.com/3Yx4zKu.png" alt="Logo" class="img-responsive" style="max-height: 40px; margin-top: 5px; margin-left: 10px"></a> </div> <div class="navbar-collapse collapse navbar-right"> <ul class="nav navbar-nav"> <li class="active"><a href="index.html">DISCOVER</a></li> <li><a href="about.html">ABOUT</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">APPLY <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="faqs.html"><i class="fa fa-question-circle" aria-hidden="true" style="margin-right: 2px;"></i> FREQUENTLY ASKED QUESTIONS</a></li> <li><a href="apply.html"><i class="fa fa-edit" aria-hidden="true" style="margin-right: 2px;"></i> SUBMIT AN APPLICATION</a></li> </ul> </li> <li><a href=""><i class="fa fa-lock" aria-hidden="true"></i></a></li> </ul> </div><!--/.nav-collapse --> </div> </div> -- > } /* End the Auth::LoggedIn() if */ else /* else - they're logged in, so show some info about the pilot, and a few links */ { /* Auth::$userinfo has the information about the user currently logged in We will use this next line - this gets their full pilot id, formatted properly */ <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="//fijivirtual.xyz/index.html"><img src="http://i.imgur.com/3Yx4zKu.png" alt="Logo" class="img-responsive" style="max-height: 40px; margin-top: 5px; margin-left: 10px"></a> </div> <div class="navbar-collapse collapse navbar-right"> <ul class="nav navbar-nav"> <li class="active"><a href="index.html">DISCOVER</a></li> <li><a href="about.html">ABOUT</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">APPLY <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="faqs.html"><i class="fa fa-question-circle" aria-hidden="true" style="margin-right: 2px;"></i> FREQUENTLY ASKED QUESTIONS</a></li> <li><a href="apply.html"><i class="fa fa-edit" aria-hidden="true" style="margin-right: 2px;"></i> SUBMIT AN APPLICATION</a></li> </ul> </li> <li><a href=""><i class="fa fa-lock" aria-hidden="true"></i></a></li> </ul> </div><!--/.nav-collapse --> </div> </div> } /* End the else */ ?> </div> </div> if(Auth::LoggedIn() == false) { ?> <div id="bodytext"> <?php /* This will insert all of the "meat" of the page in there - the template which is generated, depending on which page you're on. To change these templates, check out the docs on the site. They're under the /core/templates folder, and to change them, copy them into the folder of your skin (the folder this file is in right now. */ echo $page_content; ?> </div> </div> <!-- ***************************************************************************************************************** HEADERWRAP ***************************************************************************************************************** --> // Header image goes here <!-- ***************************************************************************************************************** SERVICE LOGOS ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** TESTIMONIALS ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** MIDDLE CONTENT ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** OUR CLIENTS ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** FOOTER ***************************************************************************************************************** --> <div id="footer"> <div class="container"> </div><! --/row --> <div class="row text-center"> <p> © 2016 Fiji Virtual | Website designed by Max Dyba</p> </div> </div><! --/container --> </div><! --/footerwrap --> <!-- Bootstrap core Javascript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/retina-1.1.0.js"></script> <script src="assets/js/jquery.hoverdir.js"></script> <script src="assets/js/jquery.hoverex.min.js"></script> <script src="assets/js/jquery.prettyPhoto.js"></script> <script src="assets/js/jquery.isotope.min.js"></script> <script src="assets/js/custom.js"></script> <script src="assets/js/wow.min.js"></script> </body> </html> And I get this error: If anyone knows how to fix this it'd be much appreciated. Thank you! Quote Link to comment Share on other sites More sharing options...
web541 Posted June 23, 2016 Report Share Posted June 23, 2016 Try this, moved around some things to make it better for phpVMS, it may not work for you so switch some things around at your discretion Main problem for this error is that you weren't closing <?php ?> tags properly and having raw php just anywhere on your page. <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <link rel="shortcut icon" href="assets/ico/favicon.ico"> <title><?php echo $page_title ?></title> <!-- Stylesheets --> <link href="<?php echo SITE_URL?>/lib/skins/fijivirtual/css/font-awesome.css" rel="stylesheet" media="all" /> <link href="<?php echo SITE_URL?>/lib/skins/fijivirtual/css/theme.css" rel="stylesheet" media="all" /> <!-- Just for debugging purposes. Don't actually copy this line! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <?php // ALL Javascript REFERENCES should be added below this line echo $page_htmlhead; ?> <!-- Bootstrap Core Javascript ================================================== --> <!-- // Removed this reference as it's already defined in core_htmlhead.php --> <!-- Might have trouble with this line if you get "no route passed --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/retina-1.1.0.js"></script> <script src="assets/js/jquery.hoverdir.js"></script> <script src="assets/js/jquery.hoverex.min.js"></script> <script src="assets/js/jquery.prettyPhoto.js"></script> <script src="assets/js/jquery.isotope.min.js"></script> <script src="assets/js/custom.js"></script> <script src="assets/js/wow.min.js"></script> </head> <body> <?php echo $page_htmlreq; ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/smoothscroll/1.4.4/SmoothScroll.min.js"></script> <script src="assets/js/modernizr.js"></script> <?php if(!Auth::LoggedIn()) { /* * This stuff will only show * When the user is not logged in */ ?> <!-- Hiding the NAVBAR at your request <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="<?php echo SITE_URL; ?>"><img src="http://i.imgur.com/3Yx4zKu.png" alt="Logo" class="img-responsive" style="max-height: 40px; margin-top: 5px; margin-left: 10px"></a> </div> <div class="navbar-collapse collapse navbar-right"> <ul class="nav navbar-nav"> <li class="active"><a href="index.html">DISCOVER</a></li> <li><a href="about.html">ABOUT</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">APPLY <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="faqs.html"><i class="fa fa-question-circle" aria-hidden="true" style="margin-right: 2px;"></i> FREQUENTLY ASKED QUESTIONS</a></li> <li><a href="apply.html"><i class="fa fa-edit" aria-hidden="true" style="margin-right: 2px;"></i> SUBMIT AN APPLICATION</a></li> </ul> </li> <li><a href=""><i class="fa fa-lock" aria-hidden="true"></i></a></li> </ul> </div> </div> </div> --> <?php } // End if not logged in else { // Else they are logged in and they can see a few more links /* $userinfo variable has been defined with the pilots user information */ ?> <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="<?php echo SITE_URL; ?>"><img src="http://i.imgur.com/3Yx4zKu.png" alt="Logo" class="img-responsive" style="max-height: 40px; margin-top: 5px; margin-left: 10px"></a> </div> <div class="navbar-collapse collapse navbar-right"> <ul class="nav navbar-nav"> <li class="active"><a href="index.html">DISCOVER</a></li> <li><a href="about.html">ABOUT</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">APPLY <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="faqs.html"><i class="fa fa-question-circle" aria-hidden="true" style="margin-right: 2px;"></i> FREQUENTLY ASKED QUESTIONS</a></li> <li><a href="apply.html"><i class="fa fa-edit" aria-hidden="true" style="margin-right: 2px;"></i> SUBMIT AN APPLICATION</a></li> </ul> </li> <li><a href=""><i class="fa fa-lock" aria-hidden="true"></i></a></li> </ul> </div><!--/.nav-collapse --> </div> </div> <?php } /* End the else */ ?> <!-- Not sure what these DIVS are closing, but I'll leave them in there --> </div> </div> <div id="bodytext"> <?php /* This will insert all of the "meat" of the page in there - the template which is generated, depending on which page you're on. To change these templates, check out the docs on the site. They're under the /core/templates folder, and to change them, copy them into the folder of your skin (the folder this file is in right now. */ echo $page_content; ?> </div> </div> <!-- ***************************************************************************************************************** HEADERWRAP ***************************************************************************************************************** --> <!-- Header image goes here --> <!-- ***************************************************************************************************************** SERVICE LOGOS ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** TESTIMONIALS ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** MIDDLE CONTENT ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** OUR CLIENTS ***************************************************************************************************************** --> <!-- ***************************************************************************************************************** FOOTER ***************************************************************************************************************** --> <?php if(Auth::LoggedIn()) { ?> <div id="footer"> <div class="container"> </div> <div class="row text-center"> <p> © 2016 Fiji Virtual | Website designed by Max Dyba</p> </div> </div> <?php } // Close If Logged In IF Statement ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
FijiVirtual Posted June 24, 2016 Author Report Share Posted June 24, 2016 Hey web541. Thank you so much. This has fixed all the issues. Mind if I include you on the upcoming credits page on my website? Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.