• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Calling joined list templates in custom templates

Hello,
I have 2 joined lists : "trips" and "departures".
"trips" can have several "departures".
I made a custom list template (based on div template) for "trips" and also have a custom list template for "departures".
Now, I'd like to call my "departures" template in "trips" list, so that beneath each trip I have a table of the trip's departures.
Is there a way to achieve this ? I couldn't find an answer on tutorials or wiki.
If not, how is it possible to replicate "departures" template in "trips" template ?

Thanks for any help with this !

NB : I bought a standard support but cannot post in standard support forum...
 
Hi
I've moved the thread to the standard support board. Try logging out and in again to ensure your credentials are up to date, you do appear on the system as a standard subscriber so you definately should be able to post.

There's no exact solution to your quesiton, but there are two ways I can see your resolving your issue:

1) Using the trips' list's related data feature. (http://fabrikar.com/forums/index.php?wiki/related-data/)
2) Using the trips' list's group by option (http://fabrikar.com/forums/index.php?wiki/list-edit/#group-by)

Related data:

This requires your departures list to have a database join element pointing to the trips list. E.g. a field called 'trip_id'.
It can be set up to show the related departure times in a modal window, using the custom template you assigned to the departures list

Group by

This would require you to create a list join between the trips and departures table (http://fabrikar.com/forums/index.php?wiki/list-edit/#joins)
This option won't allow you to use your departures template, but does allow for the departures to be shown underneath the trips list.
You would end using a combination of the list template plus the group by front end template to achieve the required layout. This might be tricky depending on how complex your original list templates were.
 
Hi Rob, and thank you very much for your answer.
I logged out and now can post in standard support forum.

Indeed, my idea was to use something like the Group by solution.
I am using Joomla articles to store the trip's title and details. For both "trips" and "departure" lists I created a dbjoin element on the article with value=article id and label=article title.
These elements are both called content_id.

I then created a list join in the trips list with the following query
PHP:
inner JOIN departures ON trips.content_id = departures.content_id

I also grouped my trips list results by departures.content_id in the trips list and added a few departures elements in the group by "user template" field.

As a result of all this, I have a trips list with grouped departures dates above it (please see enclosed picture) but :
- dates should be beneath the trip
- all my departures datas are in a fabrik_groupheading div which is not a problem in itself, but the toggle link hides the trip and not the departures
 

Attachments

  • fabrik_dbjoin_groupby.jpg
    fabrik_dbjoin_groupby.jpg
    111.9 KB · Views: 400
OK, I edited default.php template file and just had to move the fabrik_groupheading div.
Also I moved the toggle link and it now toggles my departures div.

Just a few more questions :
- do I have to style my departures group with the group by front end template field (in trips list parameters) or is there any file that I can add and customize in my template ? I'd like to add some tooltips on my departures rows...
- I'd like to show the number of departures in the toggling link and noticed that there is a function count($group) in the default.php file but it's always giving me "1" as a result. What is this for ?

Thanks again, I'm getting closer and your component is great !
 
Group count:
In your list "Data/Joins" tab set Display mode to "each row separatly".
With "merge rows" the displayed list will have exactly one record per trip containing the "merged" departure dates, so group count is 1.

But I'm not sure about your join setup:
Fabrik joins need one "leg" to be a primary key (usually the id element).
At least if you want to edit your trips list and e.g. add departure dates.

The depature dates should have a databasejoin directly to the trips list and this element should be used in the join.
 
I changed the settings as you said and it helped me to find the true problem :
I want to group my departures by trip, but if I set up a "group by" in trips list, the system wants to group my trips and not the departures that's why it's counting only 1 (trip).

The correct approach would have been to set up a list join in departures list and group by trip.
...but... I can't use this setting because I want my trips to show up even if they have no departure linked to them.

I think I'll keep my previous settings and simply calculate the number of departures with a calc field instead of using count($group).
And I also note that I could have used a repeating group to achieve the same result...

Thanks anyway !
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top