0

I am developing a component 'com_datamanager' with an "Admin Dashboard" using ElaAdmin HTML5 Admin Dashboard Template. I have been able to create a simple component with multiple views without the dashboard template and it works.

But now I am stuck at how to add the 'dashboard theme' and which section whether in the view.html.php or tmpl/default to place all the "sidebar navigation"

The navigation will hold a link to all the various views of the component such as create, edit, delete, messages, product details, product list etc and it must also appear on all the above mentioned views.

I will be glad if someone can help me. thank you

David Addoteye
  • 1,587
  • 1
  • 19
  • 31
  • 1
    You can create new View of dashboard where all the html will be there according to your themed dashboard and all the links of view whatever you want to show on dashboard. – Sudhir Sapkal May 22 '18 at 12:18
  • @SudhirSapkal thanks. how do i call the various sections such as product list and product detail from the dashboardView? – David Addoteye May 22 '18 at 12:27

1 Answers1

3

Follow below steps

  1. Create helper file of component if you it is not already there and paste below code in your helper file of component. If file is already there only past function part.

    class MyComponentHelper { public static function addSubmenu($vName = "") { JHtmlSidebar::addEntry( JText::_('Product List'), 'index.php?option=com_mycomponent&view=products', $vName == 'products' ); JHtmlSidebar::addEntry( JText::_('Product'), 'index.php?option=com_mycomponent&view=product', $vName == 'product' ); } }

  2. Now go to yours views/dashboard's view.html.php file and paste below code before the display method call.

    MyComponentHelper::addSubmenu('products');

Same code snippet will go in the product view also just change the view

Let me know if you face difficulties in this. It would be more help full if you post components file structure here.

Sudhir Sapkal
  • 1,018
  • 7
  • 14
  • it means this code | MyComponentHelper::addSubmenu('products'); | must be added to all the views I want the sidebar to appear – David Addoteye May 22 '18 at 13:18
  • is it possible to do that in the main controller without creating a helper file? – David Addoteye May 22 '18 at 13:19
  • 1
    @DavidAddoteye "Yes absolutely right" answer for comment number 1, and yes you can write it in controller but won't recommend as controller is only to control the request which are coming through view and model. – Sudhir Sapkal May 22 '18 at 13:24
  • I did it and it works. The look is just like the normal joomla sidebar menu. Can I replace your code with a custom code from the adMin Template which is both html and php. – David Addoteye May 22 '18 at 13:31
  • You will need to override sidebar layout of joomla – Sudhir Sapkal May 23 '18 at 04:10