Adding New Buttons to Top Header

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
TheNoLifer
Veteran Member
Posts: 67
Joined: 2015-06-06 12:10

Adding New Buttons to Top Header

Post by TheNoLifer » 2015-12-17 15:46

Hey All,

Does anyone know where to edit the very top header bar. I've tried the header-extras.php hook and other places - can't figure out where this is built from. I have seen screenshots of other folk's applications with extra buttons up here - so I know it's possible.

Trying to insert buttons to the right (or possibly Left) of the Sign In.
new_buttons.PNG
new_buttons.PNG (23.64 KiB) Viewed 7510 times

Thank you!

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: Adding New Buttons to Top Header

Post by peebee » 2015-12-18 06:27

The "Sign In" button is generated in incCommon.php

It will depend on which version of AppGini you are using but in the new V5.5.0 it's the <ul> around line 334 to 362

Look for code around there starting with <ul class="nav navbar-nav">

You should be able to add your additional button in there.

TheNoLifer
Veteran Member
Posts: 67
Joined: 2015-06-06 12:10

Re: Adding New Buttons to Top Header

Post by TheNoLifer » 2015-12-18 14:28

Thanks Peebee! That's it!
test_button.PNG
test_button.PNG (33.37 KiB) Viewed 7486 times
For future reference and people looking to do the same, here is the specific section in the inCommon.php;

Code: Select all

<?php if(!$_GET['signIn'] && !$_GET['loginFailed']){ ?>
					<?php if(getLoggedMemberID() == $adminConfig['anonymousMember']){ ?>
						<a href="index.php?signIn=1" class="btn btn-success navbar-btn navbar-right"><?php echo $Translation['sign in']; ?></a>
						<a href="SOME LINK" class="btn btn-success navbar-btn navbar-right">Test Button</a>
						<p class="navbar-text navbar-right">
							<?php echo $Translation['not signed in']; ?>
						</p>
					<?php }else{ ?>
						<a class="btn navbar-btn btn-default navbar-right" href="index.php?signOut=1"><i class="glyphicon glyphicon-log-out"></i> <?php echo $Translation['sign out']; ?

></a>
Cheers

User avatar
jmcgov
Veteran Member
Posts: 79
Joined: 2018-12-19 01:31
Location: Northern Ireland

Re: Adding New Buttons to Top Header

Post by jmcgov » 2019-09-20 23:55

Try this in the hooks/header-extra.php file, before the PHP open tag

Code: Select all

<script>
	$j(function(){
		$j('.navbar-btn').parent().prepend('<a class="btn navbar-btn btn-danger" href="https://www.URL.co.uk/contact-us"><i class="glyphicon glyphicon-envelope"></i> Help Me</a>'); 
	});
</script>

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Adding New Buttons to Top Header

Post by federico » 2020-11-28 18:55

jmcgov wrote:
2019-09-20 23:55
Try this in the hooks/header-extra.php file, before the PHP open tag

Code: Select all

<script>
	$j(function(){
		$j('.navbar-btn').parent().prepend('<a class="btn navbar-btn btn-danger" href="https://www.URL.co.uk/contact-us"><i class="glyphicon glyphicon-envelope"></i> Help Me</a>'); 
	});
</script>
Hi
I'm trying to insert this but links appear repeated close to every button. I just need only one link :lol:
How can I fix it?

thanks

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Adding New Buttons to Top Header

Post by pbottcher » 2020-11-28 20:19

Try

Code: Select all

<script>
	$j(function(){
		$j('.navbar .navbar-right').prepend('<a class="btn navbar-btn btn-danger" href="https://www.URL.co.uk/contact-us"><i class="glyphicon glyphicon-envelope"></i> Help Me</a>'); 
	});
</script>
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Adding New Buttons to Top Header

Post by federico » 2020-12-01 15:36

ahhh 2 links still remain...
PS there's also a list where I can get the icons? They are very nice
Attachments
extraheader.png
extraheader.png (9.12 KiB) Viewed 3706 times

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Adding New Buttons to Top Header

Post by jsetzer » 2020-12-01 15:56

Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Adding New Buttons to Top Header

Post by federico » 2020-12-01 16:02

thank you so much!!!

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Adding New Buttons to Top Header

Post by pbottcher » 2020-12-01 16:49

try

<script>
$j(function(){
$j('ul.nav.navbar-nav.navbar-right.hidden-xs').prepend('<a class="btn navbar-btn btn-danger" href="https://www.URL.co.uk/contact-us"><i class="glyphicon glyphicon-envelope"></i> Help Me</a>');
});
</script>
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

federico
Veteran Member
Posts: 74
Joined: 2020-10-29 14:52

Re: Adding New Buttons to Top Header

Post by federico » 2020-12-01 16:51

It works! thank you very much pböttcher!!!

mwilliam
Veteran Member
Posts: 32
Joined: 2018-03-31 09:03
Location: London, Kentucky

Re: Adding New Buttons to Top Header

Post by mwilliam » 2020-12-10 15:28

pbottcher, how would you do that code with a pop out window, or better known as a new window

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: Adding New Buttons to Top Header

Post by pfrumkin » 2020-12-10 18:29

Have you tried

Code: Select all

target="_blank"
in the anchor tag (<a>)?

That is a new window, not a pop up.

~Paul

Post Reply