Hello, Guest.

Adding Toolbar for NonCoders

This tutorial is meant for regular users who are not well versed with PHP and unable to follow our developer-oriented Toolbar API.

The tutorial will cover on basic aspects of adding a new Toolbar Group item and will not elaborate on modifying existing toolbar items.

Contents

Default Toolbar

Default JomSocial Toolbar

Modified New Toolbar

New Modified JomSocial Toolbar

Starting the modification

Before starting our modification, we always try as much as possible not to alter core JomSocial files. Luckily in JomSocial, we implement Joomla! MVC (Multiple View Controller) close to our heart. Basically, you will need to enable JomSocial template override mechanism by:

a. copying this file: /components/com_community/templates/default/toolbar.index.php
b. head to: /templates/{yourcurrentjoomlatemplate}/html/
c. create a new directory inside /html named: com_community
d. paste toolbar.index.php inside the new com_community

JomSocial will detect this modification and use the overridden toolbar file.

Modifying the Toolbar file

Locate this code (roughly line 128, JomSocial 1.6.250)

<li id="toolbar-item-inbox" class="<?php echo $toolbarClass[TOOLBAR_INBOX];?>">
<a href="<?php echo $inboxItem->link; ?>" onmouseover="joms.toolbar.open('m4')" onmouseout="joms.toolbar.closetime()">
<?php echo $inboxItem->caption; ?></a>
<div id="m4" onmouseover="joms.toolbar.cancelclosetime()" onmouseout="joms.toolbar.closetime()" style="visibility: hidden;">
<?php echo $customToolbar->getMenuItems(TOOLBAR_INBOX, 'prepend'); ?>
<?php echo $customToolbar->getMenuItems(TOOLBAR_INBOX, 'append'); ?>
</div>
</li>
<?php
	}
	}			
}
?>


Paste this code after it

<li class="" id="toolbar-item-apps">
<a onmouseout="joms.toolbar.closetime()" onmouseover="joms.toolbar.open('m5')" href="/index.php?option=com_community&amp;view=apps&amp;Itemid=2">New Group Toolbar</a>
<div style="overflow: hidden; visibility: hidden;" onmouseout="joms.toolbar.closetime()" onmouseover="joms.toolbar.cancelclosetime()" id="m5">
<a href="/index.php?option=com_community&amp;view=apps&amp;Itemid=2">My Forum Posts</a>
<a class="has-separator" href="/index.php?option=com_community&amp;view=apps&amp;task=browse&amp;Itemid=2">View Forum Replies</a>
<a href="/index.php?option=com_community&amp;view=groups&amp;task=mygroups&amp;userid=62&amp;Itemid=2">Item A</a>
<a href="/index.php?option=com_community&amp;view=photos&amp;task=myphotos&amp;userid=62&amp;Itemid=2">Item B</a>
<a href="/index.php?option=com_community&amp;view=videos&amp;task=myvideos&amp;userid=62&amp;Itemid=2">Item C</a>
</div>
</li>


Save, and you are now done. You now have a new Toolbar Group Item (m5). To add or remove child items, simply add or delete any of the lines below:

<a href="/index.php?option=com_community&amp;view=apps&amp;Itemid=2">My Forum Posts</a>
<a class="has-separator" href="/index.php?option=com_community&amp;view=apps&amp;task=browse&amp;Itemid=2">View Forum Replies</a>
<a href="/index.php?option=com_community&amp;view=groups&amp;task=mygroups&amp;userid=62&amp;Itemid=2">Item A</a>
<a href="/index.php?option=com_community&amp;view=photos&amp;task=myphotos&amp;userid=62&amp;Itemid=2">Item B</a>
<a href="/index.php?option=com_community&amp;view=videos&amp;task=myvideos&amp;userid=62&amp;Itemid=2">Item C</a>


What is class="has-separator"?
It adds a separator in between child items as shown in the image below:
Separator Class in Toolbar

Adding a Second or More Toolbar Group Items

To add another Group item, simply copy the complete code shown above, and paste it after the first modified Group Item.

However, do not save the file yet. Locate two instances of m5 and change it to m6. This counter is used for javascript and div id.

m5 in for javascript

Docs Navigation

JomSocial Video Testimonial Contest. Top 5 best videos wins iPod Nano 4G.

Slashes & Dots Sdn. Bhd.
MALAYSIA OFFICE
No 1-7, Signature Office,
The Boulevard Mid Valley City,
Lingkaran Syed Putra,
59200 Kuala Lumpur, Malaysia.
U.S. OFFICE
251 West Central Avenue #146,
Springboro, Ohio 45066, U.S.A.

Tel: +60 (3) 2282-1997
Fax: +60 (3) 2283-1997
E-mail:
Copyright © 2007 - 2009 JomSocial.com. All rights reserved.
JomSocial is made for Joomla!
JomSocial Community Count

637 users currently online | 84564 forum posts