How to embed a Catalog to any layout – two options #
You can insert records from any other table using “tables.getrecords” tag: #
Example: {{ tables.getrecords("CountriesPage","population>1000000","name",20) }}
Where CountriesPage is the layout name.
“population>1000000” where the condition or the filter
“name” – the field to sort the records by. Descending order is also possible “name desc”
20 – number of records (limit)
You can also do it using IFrame #
If you want a functional catalog embedded in a Layout or an article, use the HTML IFrame tag. You can provide some URL query parameter to filter catalog records.
Below is an example of a Catalog in side Edit Record Layout:
Where “/index.php/subjects-list” is the link to a menu item that has Custom Tables – Records menu type
“type=3” is a query parameter that we want to pass as a filter parameter.
Where “3” is the ID of the current record, if the page where you want to have a functional catalog is Add/Edit Record or Record Details type.
“tmpl=component” is to not avoid rendering the front-end template.
This is Custom Tables – Records type menu item.
I passed parameter type with the URL query. Now we will use it to filter catalog records.
I have a field “type” in my table. I want to show all the records that have the type id equal to type URL parameter.
{{ url.getint(“query parameter” }} is the tag to get URL parameter value.
Leave a Reply
You must be logged in to post a comment.