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.064 seconds

This is what you call a component builder. I was able to master using this in a very short time and the resulting component works like a charm. Not just a basic component builder but a fully working component builder with forms fields tables all ready to go. You can make the list and item views to display in the front and back end. Also there is a great forum just starting to evolve and I'm sure this will grow very rapidly when you all realise how good this tool is.
Kevin (JED)

         

Get Started