SOLVED: Help with Custom/Print Template - arrrgggghhh

bggann

Active Member
Just created a custom template that displays just the "calculations" row from a grouped list.
This is a special formatted display for reports to vendors. I do not need to display the group records, just the totals.

Got it working in list display.

Hit print - and the print is formatted based on the PDF template for the list, not the template in the menu. ARGGHH - that means all my custom template work is not useful because I must be able to print from this.

I can change the pdf template for the 'list', but then I can't print normal list displays.

Is there anyway to override the print/pdf template from a menu.

I suppose I can "copy" the list and create a second list that has the other template, but in my experience, that turns into a mess with large lists that have lots of elements.

Suggestions?

Bob
 
I'm still trying to work around this - and I'm confused by the "print/PDF" Icon (see attached first capture/image). On my forms I see "print, email and pdf" icons. The Print creates a window with a 'print' rendering. PDF downloads a pdf.

On my list display - all that shows is print button - can't find anyplace to show the PDF button (see 2nd capture/image). Not sure it would help, but maybe....
I need to be able to select a different template for printing based upon the report (ideally, it would be in the menu).

This is what is on the form.
View attachment 17431

This is what is on the list display.
View attachment 17432
 
In the list there's only a PDF button, no Print button.

You can override the PDF template by adding &pdf_template=your-template to the URL.

If you are running a recent GitHub version (not sure if it's already in the official Fabrik3.8.1) you have a list menu option "Extra Query String".
If you want to override the PDF template for one menu item add there
&pdf_template=your-template
 
Thanks Troester... It's weird that my list shows "Print" instead of pdf, but the behavior is pdf. I am running 3.8.1, not GitHub and I'm very careful to upgrade this site as it is actively used by our firefighting operations.

I do not see any "Extra Query String" in the menu options, so that must be in the Git, not the released version.

So- it looks like I'll have to use a menu link that is not the normal Fabrik/List Menu item, but a System/External URL menu link to add this to the URL. I see no way to add this to the URL created by the Fabrik/List menu item without that extra query string option- am I correct in that.

That will solve my problem. Thanks!
I'll let you know how it goes.

-Bob
 
hmm, I think the pdf_template option is also only in GitHub.

3.8.1 has date 2018-02-16, the pdf commit was 2018-02-19
https://github.com/Fabrik/fabrik/commit/aa6d6267152e9f0f43eb5a79b2e3b55b908f3d52

The &pdf_template= function in the URL does appear to work in 3.8.1 - if I add it to the URL generated by the print button, it creates a pdf using my new template.
BUT - that doesn't really solve my problem.

I have no way to insert that &pdf_template into the print URL that I know of. I can't create a custom menu link to the list because the list is filtered for an aircraft and date range, then grouped, all before the PRINT is done. The filters used vary so I have no way to anticipate what filtering to do before the print.

So - while the extra query part seems like it would work - I don't have it on 3.8.1 and upgrading to an unreleased (Github) is pretty scary for this site.

This is an operational firefighting site - and we are on fire here, so the site must stay up.

-- Any way I can customize the print button (yes, that would be a non-upgradable patch, but I'm willing to do that).

Bob
 
If the &pdf_template is working (seems the 3.8.1 release has been created a bit after the GitHub tag) you can create a custom list template (you have already created the PDF template so I assume you know how to) and modify default_buttons.php.

Around line 108 change
<li><a href="<?php echo $this->pdfLink;?>" class="pdfButton">
to
Edited:

<li><a href="<?php echo $this->pdfLink . '&pdf_template=your-PDF-template';?>" class="pdfButton">
 
Last edited:
Fantastic. Yes, I do know how to create a custom template and I remember seeing the default_buttons file. Why it didn't occur to me that I could custmize the PDF button there....
 
default_buttons.php is very useful.
You can also add multiple PDF buttons with different templates, different CSV exports etc.
 
Worked like a charm. I assume you meant &pdf_template=
not &pdf_element= in your reply - so that is what I did.
I also used this file to suppress the toggle button since toggling messes up my collapsed template.

I put in...
<li><a href="<?php echo $this->pdfLink . '&pdf_template=your-PDF-template';?>" class="pdfButton">
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top