0

I have a problem rendering breadcrumbs in a custom component.

1) I need to render breadcrumbs in my component like this:

home/menu_item_level_1/my_component_view_name

But I don't know how to render breadcrumbs core component in my component.

or how to load breadcrumbs for menu "menu_item_level_1" (let's say it has id=1).

The problem is that the breadcrumbs module needs a menu item. But I can only create a menu item for a specific page like this /component/com_mycomponent/?id=1. I can't create a menu for a dynamic url like: /component/com_mycomponent/?id=$id

Can someone help me?

1 Answer 1

2

Ok, Iguess I found decision BY MYSELF!

1) Add .xml file to view, that will match your .php file in view's layout.

Example: you have com_competition\site\views\competition\tmpl\default.php

Add default.xml in the same directory with code. The main thing to remember is that it's name should match with the name of your .php layout file.

<?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_COMPETITION_COMPETITION_VIEW_DEFAULT_TITLE"> <message>COM_COMPETITION_COMPETITION_VIEW_DEFAULT_DESC</message> </layout> <fields name="request" addfieldpath="/administrator/components/com_competition/models/fields" > </fields> </metadata>

2) Go to admin panel and add new menu item and choose your type link "COM_COMPETITION_COMPETITION_VIEW_DEFAULT_TITLE".

3) You can send $id this way in browser home/your_menu_1/your_new_component_menu/?id=2

So, follow this steps you will create SEF links and add breadcrumbs to your component. Cheers! Profit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.