Page 1 of 1

Navbar Buttons

Posted: 2024-09-06 15:53
by SkayyHH
I need 2 buttons in the navigation bar and i tried this code in header-extras:

Code: Select all

<?php if(!defined('PREPEND_PATH')) define('PREPEND_PATH', ''); ?>

<script>
	$j(function(){
 		$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>hooks/calendar-kalender.php"><i class="glyphicon glyphicon-list"></i> Wiedervorlagen</a>'); 
		$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>employees_de_view.php"><i class="glyphicon glyphicon-user"></i> Mitarbeiter</a>');
	});
</script>
Can someone please help me modify the code so that the buttons don't appear on the login page?

Thank you very much!

Re: Navbar Buttons

Posted: 2024-09-06 16:13
by SkayyHH
There's one thing I forgot. The session ID needs to be appended to the button link (here employee_de). Unfortunately, I wasn't able to manage that. So like this: employees_de_view.php?t=1725639003

Re: Navbar Buttons

Posted: 2024-09-14 18:42
by pbottcher
Hi,

you may try in your script:

Code: Select all

	$j(function(){
		if (window.location.href.indexOf('index.php') == -1) {
			$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>hooks/calendar-kalender.php"><i class="glyphicon glyphicon-list"></i> Wiedervorlagen</a>'); 
			$j('.navbar-header').prepend('<a class="btn navbar-btn btn-primary" style="margin-top: 10px; font-weight: bold;" href="<?php echo PREPEND_PATH; ?>employees_de_view.php"><i class="glyphicon glyphicon-user"></i> Mitarbeiter</a>');
		}
	});