Page 1 of 1
Nav bar, links
Posted: 2020-02-24 15:04
by eremmen
Dear Community Forum,
thanks for a lot of helpful tips and tricks, what a rewarding place to be! A novice user myself, and so great to learn from other's experiences.
We would like to have the links as seen on the image here, also on the index page. How can I do this? I hope this has not been posted before, I could not find it when I looked.
Have a great week!
E

- Home/index page
- indexphp.PNG (122.44 KiB) Viewed 8707 times
Re: Nav bar, links
Posted: 2020-02-24 16:00
by jsetzer
Dear Else and Torulf,
you can change this default behaviour in
incCommon.php. Find the function
htmlUserBar(). There are the following lines:
Code: Select all
<ul class="nav navbar-nav">
<?php if(!$home_page) { ?>
<?php echo NavMenus(); ?>
<?php } ?>
</ul>
You can change or remove the whole
if { }-clause and only keep the
echo NavMenus(); line.

- Code_KiXYMYgi9b.png (32.35 KiB) Viewed 8704 times
Afterwards, the nav-menus will be visible on homepage, too.

- thunderbird_wfCgJBmrfA.png (4.4 KiB) Viewed 8704 times
Caution: On next generation with will be overwritten.
Hope your project is #1 in Norway now!
Best,
Jan
Re: Nav bar, links
Posted: 2020-02-24 21:55
by pbottcher
Hi,
if you do not want to edit the created file from AppGini (which will be overwritten as Jan stated), add the following to the hooks/header-extras.php file
Code: Select all
<?php
$home_page = (basename($_SERVER['PHP_SELF'])=='index.php' ? true : false);
if ($home_page) {
?>
<script>
$j(function() {
var x = '<?php echo str_replace("\r\n",'',str_replace("\t",'',NavMenus()));?>';
$j('.nav.navbar-nav:first').append(x.replace(/\t/g,''));
})
</script>
<?php
}
Re: Nav bar, links
Posted: 2020-02-25 08:27
by eremmen
Thanks guys, for the tip and for the immediate response! It worked a treat.
Jan, I wish I could tell you that we are #1 in Norway, but not quite there yet! But we will be
Thanks again, and have fun with your code.
E

Re: Nav bar, links
Posted: 2020-02-25 09:28
by jsetzer
Hi @pböttcher,
very good idea and a great tip, thank you very much!
One small thing is happening now: On
login-page we now get an empty "Jump-to"-dropdown

- chrome_ngIZYrnsZk.png (9.45 KiB) Viewed 8663 times
I think next to checking if we are on
index.php we should also check if
signIn parameter is defined or not.
I hope you don't mind if I add a very little piece to your code:
Code: Select all
<?php $is_homepage = (basename($_SERVER['PHP_SELF']) === 'index.php' && !isset($_REQUEST['signIn'])); if ($is_homepage) { ?>
<script>
$j(function() {
var x = '<?php echo str_replace("\r\n", '', str_replace("\t", '', NavMenus())); ?>';
$j('.nav.navbar-nav:first').append(x.replace(/\t/g, ''));
})
</script>
<?php } ?>
Now the menu's should
not be visible on login page...

- chrome_oaXmrByXIv.png (10.16 KiB) Viewed 8663 times
... but should be visible on dashboard ...

- chrome_EFZDx0ctBm.png (46.02 KiB) Viewed 8663 times
Best,
Jan
Re: Nav bar, links
Posted: 2020-02-25 19:04
by pbottcher
true

Re: Nav bar, links
Posted: 2021-06-13 13:57
by federico
and how do you clean the index page keeping only the navigation bar?
in header page?
tks