I will show you how to add a custom link to work side-by-side with the Register and Login buttons. This example is demonstrated on Corporate 2 template, but can be easily done with other GK template that have this feature.
For the example, i will add link to Joomla! Contact Component page. So, the first step is to create the link on source file. Open this file ../gk_corporate2/layouts/blocks/toolbar.php and find this line:
- Code: Select all
<a href="<?php echo $this->baseurl(); ?>index.php?option=com_user&view=login" id="btn_login"><?php echo ($userID > 0) ? JText::_('GK_LOGOUT') : JText::_('GK_LOGIN'); ?></a>
<?php endif; ?>
replace it with:
- Code: Select all
<a href="<?php echo $this->baseurl(); ?>index.php?option=com_user&view=login" id="btn_login"><?php echo ($userID > 0) ? JText::_('GK_LOGOUT') : JText::_('GK_LOGIN'); ?></a>
<?php endif; ?>
<a href="<?php echo $this->baseurl(); ?>index.php?option=com_contact&view=contact&id=1&Itemid=78" id="btn_contact"><?php echo JText::_('Contact Us!'); ?></a>
On frontend, this would be the result:
It look good but not the best result, because if you click on tools button, the "Contact Us!" will be always there. Not a very good effect... So how to we change this and add the same fade effect to "Register" and "Login" button?
Open this file ../gk_corporate2/js/gk.script.js and find this line:
- Code: Select all
var link_reg_fx = null;
replace it with
- Code: Select all
var link_reg_fx = null;
var link_contact_fx = null;
Then find this line:
- Code: Select all
if($('btn_register')) link_reg_fx = new Fx.Opacity($('btn_register'),{duration:300});
replace it with
- Code: Select all
if($('btn_register')) link_reg_fx = new Fx.Opacity($('btn_register'),{duration:300});
if($('btn_contact')) link_contact_fx = new Fx.Opacity($('btn_contact'),{duration:300});
Finally, find this line:
- Code: Select all
if($('btn_register')) link_reg_fx.toggle();
replace it with:
- Code: Select all
if($('btn_register')) link_reg_fx.toggle();
if($('btn_contact')) link_contact_fx.toggle();
That's it!
Hope this may be useful for you guys.
Cheers