Navbar Content Pages

Post Reply
kolimbursi
Ssr. Bludit
Posts: 24
Joined: Tue Feb 11, 2020 10:00 am

Tue Apr 07, 2020 8:59 am

Hello!

Maybe you can help me with this - I tried to rewrite it without success:

my navbar looks like this:

Code: Select all

<nav class="navbar navbar-expand-md bg-custom text-uppercase boxshadow-4">
	<div class="container">
		<a data-aos="fade-down" data-aos-duration="800" class="navbar-brand" href="<?php echo Theme::siteUrl() ?>">
			<span class="text-white"><?php echo $site->title() ?></span>
		</a>
		<button class="navbar-toggler text-white" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
			<span class="la la-bars"></span>
		</button>
		<div class="collapse navbar-collapse" id="navbarResponsive">
			<ul class="navbar-nav ml-auto">
				<!-- Static pages -->
				<?php foreach ($staticContent as $staticPage): ?>
				<li class="nav-item" data-aos="fade-down" data-aos-duration="600">
					<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
				</li>
				<?php endforeach ?>
				

			</ul>
		</div>
		
	</div>
</nav>
I have a very small page - and I would like all my pages which are not static - to display in the navbar as well. a static page is not an option.

thank you very much for help!
User avatar
Jay
Master Bludit
Posts: 106
Joined: Mon Feb 11, 2019 8:41 pm

Wed Apr 08, 2020 12:27 am

Check all available bludit themes. Some of them contain code in navbar responsible for listing all non static pages.
kolimbursi
Ssr. Bludit
Posts: 24
Joined: Tue Feb 11, 2020 10:00 am

Thu Apr 09, 2020 2:35 pm

thank you I will do that!
User avatar
Torsten_Kelsch
Legend Bludit
Posts: 211
Joined: Thu Aug 27, 2015 10:24 pm
Location: Germany
Contact:

Fri May 15, 2020 10:42 pm

I couldn’t find such a code that really works until today, so I always build the navigation by hand like this (in this example Bludit isn’t installed in a subdirectory):

Code: Select all

<?php $requri = $_SERVER['REQUEST_URI']; ?>
<ul>
  <li<?php if($requri == "/page1") { echo ' class="current"';} ?>><a class="nav-link" href="https://www.example.com/page1">Page 1</a></li>
  <li<?php if($requri == "/page2") { echo ' class="current"';} ?>><a class="nav-link" href="https://www.example.com/page2">Page 2</a></li>
  <li<?php if($requri == "/page3") { echo ' class="current"';} ?>><a class="nav-link" href="https://www.example.com/page3">Page 3</a></li>
</ul>
On Error GoTo Bed
Post Reply