Print only some items from the list

nofc_fro

Member
Hi,
I would like to create a custom template and I need to decide which fields to show in the PDF.
For example: in the list if I have ID, name, phone and in the PDF I would like to show only name, phone.

In the "default_row.php" file, the records are printed, while in the "default.php" file the headings are printed, right?

How can I do?
Thank you
 
Since you are mentioning default_row and default.php, I assume you are talking about the list template.

You don't need to create a custom template to do this - in fact, you don't want to. The custom pdf template is to control the format and layout, not so much the content.

If the element is shown in the list display, then it will be shown in the pdf. It is not, then it will not.
There are 2 ways to control if an element is shown in the list.

Global way: This will impact all list displays.
- In the "element" settings under List settings, you can set an element to "show in list" or no. You can also set this in the element display on the backend- to the right you will see two columns, "Show in List" and "Published". You can change it there.

Menu way:
- In the menu item accessing the fabrik list:
- Look under "Fabrik List Options"
- See "Show in list"
By default, all elements set to "show in list" will be displayed, but if you click on Show in list in the menu, you can choose what elements you want to display and in what order.
This is really nice because you can make different menus that display the list in different ways. The pdf will reflect what is displayed.

Oh - there is a 3rd way.
If you have the list set to show "Toggle" where you can toggle on/off columns, you can use that function to choose elements, then the pdf will reflect what you have toggled.

None of these require a custom template....
- bg
 
Ok thanks you are very kind!
However I would need to customize the code, is it very complicated?

I also tried the third option you recommended, but it does not work ...
 
Last edited:
To recap, I have created a customized version of the list template here:

component / com_fabrik / view / list / tmpl / bootstrap-customized

then in the "Layout" tab of the list, I set "PDF template" with "bootstrap-customized".

Finally I opened the "default.php" file of the customized version and the one I ask is:
>> what is the string to print the field variable - for example - age?

fabrik-code-php.jpg
 
If you want to skip e.g. an element you must

skip the column heading in
default_headings.php

and skip the element in each table row in
default_row.php

If you don't want to loop over the elements you have to replace the "foreach ..." in these files and display the column headers and elements in the rows directly.

If you want some "catalog style" instead of a HTML table use the div template as starting point for your custom template.

http://fabrikar.com/forums/index.php?wiki/creating-a-custom-list-template/
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top