Displaying our article titles on the Nav Bar
Turning to the public side of things, we need to adapt our horizontalNav.bxm file to display the titles of articles we want users to choose from to read.
We need our public index to work like our management index where we can say which tool to open up.
<body>
<bx:param name="tool" default="carousel" />
<div id="wrapper" class="container">
and....
<div id="maincontent" class="row">
<section id="center" class="col-sm-9 order-last">
<bx:include template="carousel.bxm" />
<bx:output>
<bx:include template="#tool#.bxm" />
</bx:output>
</section>
<bx:set articleService = new finalProject.common.Articles() />
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">
<img src="/images/rdb.png" alt="Read Dees Books Logo"/>
</a>
<bx:set articleService = new finalProject.common.Articles() />
<bx:set allArticles = articleService.allArticles( status=1) />
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">
Lastly we need to loop over the query to create an item in our nav bar on which to click. We will need to pass in the id so we know which article to display, but we will also need in the tool value which will have a value of "articles".
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home </a>
<a class="nav-link" href="/finalProject/public">Home </a>
</li>
<bx:output>
<bx:loop array="#allArticles#" index="article">
<li class="nav-item">
<a class="nav-link" href="#cgi.script_name#?articleId=#article.id#&tool=articles">#article.title#</a>
</li>
</bx:loop>
</bx:output>
<li class="nav-item">
<a class="nav-link" href="#">Store Information</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Highlighted Favorites</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Events</a>
</li>
Open your public facing page ( /bookstore/public/index.bxm ). Do your active acticles appear in the top nav bar? If you go back to the management page, edit an article and make it active or inactive, does the corresponding article appear or disappear on the public page?
If there are any other menu items you want to remove or design changes, feel free to make them.