Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Add link to another component in cpanel 04 Jul 2014 13:33 #12502

Ok, so I have created two components that work independently but also have the ability to reference each other and use data from one another. I would like to set up a link between each of the components control panel and currently I am checking the database to see if a certain table is present if it is add another link.

I can get an extra link to display but i don't know how to make it link to another component, here is my code so far.

File: administrator/components/com_mycomponent/helpers/helper.php
switch($alias)
{
	case 'cpanel':
	case 'menu':
	default:
		$links = array(
			'admin.customers.default',
			'admin.venues.default',
			'admin.riskassesment.default',
			'admin.events.default',
			'admin.floorplans.default',
			'admin.eventmenus.default'
		);
						
		$tables = JFactory::getDbo()->getTableList();
		$mainframe = JFactory::getApplication();
		$prefix = $mainframe->getCfg('dbprefix');
		
		if(in_array($prefix.'serveit_mealcategories', $tables)) {
			array_push($links, 'com_serveit.default');
		}
								
		if ($alias != 'cpanel')
			array_unshift($links, 'admin.cpanel');
					
		break;
		}

so I just need to know how to create a link to the control panel of my other component,

Thanks in advance.

Please Log in or Create an account to join the conversation.

Add link to another component in cpanel 07 Jul 2014 08:47 #12506

Anyone got any ideas?

Please Log in or Create an account to join the conversation.

Add link to another component in cpanel 16 Jul 2014 12:59 #12513

I still haven't worked this out don't suppose anyones got any smart ideas I can try?

Please Log in or Create an account to join the conversation.

Add link to another component in cpanel 22 Jul 2014 10:51 #12516

There is in the helper.php a function called "getMenuItems"

You should add:

$items = array(
'label' => 'My Label',
'view' => 'default',
'icon' => 'icon',
'extension' => 'com_serveit'
);
icon should be something available in your component
Fork it if you do not want it overwritten with a new version of your component ;)
aka: copy
administrator/components/com_mycomponent/_fork/helpers/helper.php
to
administrator/components/com_mycomponent/fork/helpers/helper.php

and add the functions you changed, I hope you understand how the forking works :)

Good luck :)
The following user(s) said Thank You: admin, cefnllys

Please Log in or Create an account to join the conversation.

Add link to another component in cpanel 23 Jul 2014 14:43 #12521

Awsome! Thank you very much!
That has indeed enabled me to do what I wanted, and thankfully it wasn't too hard to implement

Thank you Romkabouter

Please Log in or Create an account to join the conversation.

Add link to another component in cpanel 26 Jul 2014 11:21 #12541

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
In future, the menus will be handlable in XML special files.
For the moment many customs are localized in the helper.php

Thank you very much Romkabouter
K++;
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.131 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started