fritzmg / contao-sharebuttons

Simple extension to provide share buttons as a module and content element in Contao
GNU Lesser General Public License v3.0
18 stars 2 forks source link

No PDF content of news reader module #48

Open Aybee opened 3 years ago

Aybee commented 3 years ago

Contao 4.9.9

Hallo Fritz, du benutzt die URLs zu den Artikeln z.B. page/articles/article-alias.html?getpdf=42 um die PDFs zu generieren. Jetzt ist es aber so, dass wenn ein Newsreader im Artikel ausgegeben wird, dass der Reader dann natürlich keine News ausgeben kann und die PDF somit leer ist.

Ich habe mir jetzt erstmal damit geholfen, dass ich über eine Templateänderung nicht die Links mit .../articles/article-alias.html... nehme, sondern sie umforme nach z.B news/details/news-alias.html?getpdf=42. Dies funktioniert einwandfrei. Die Templateanpassung ist allerdings etwas aufwendig, da ich nach dem autoitem suchen muss, falls vorhanden, und auf anderen Seiten nach dem pagealias.

Wieso nimmst du nicht auch direkt diese normalen Links, die Erweiterung contao/tcpdf-bundle von Leo nimmt die auch, und dann würde es doch funktionieren, oder habe ich da etwas nicht bedacht?

fritzmg commented 3 years ago

Wieso nimmst du nicht auch direkt diese normalen Links, die Erweiterung contao/tcpdf-bundle von Leo nimmt die auch, und dann würde es doch funktionieren, oder habe ich da etwas nicht bedacht?

🤷 I implemented this a long time ago and never used this feature myself or in any of our customer's projects. Feel free to create a PR with the correct link ;)

Aybee commented 3 years ago

Ok, thank you. I will take a look at how Leo does it in his extension and will come back. Thank you.

ps I also never used this. A customer wants those share buttons and PDF link.

Aybee commented 3 years ago

So far I repaired it with JS

// templates/j_patch-share-buttons-pdf.html5 - info@andreasburg.de
jQuery(function($) {

  var pdfLinks = $('.sharebuttons .pdf'),
      path = window.location.pathname.replace('/', '');

  pdfLinks.each(function() {
    var articleId = $(this).attr('href').split('=').pop();
    $(this).attr('href', path + '?getpdf=' + articleId);
  });

});
fritzmg commented 3 years ago

Fixed in 3dd4402.

Aybee commented 3 years ago

Thank you Fritz 👍

Unfortunately, the PDF generation now only works if the option is checked in the article. The customer uses the sharebutton module included in the layout, to show them page wide.

We explicitly tested this with version 2.1.5. That works without checking the option in the article. With 2.1.7 it no longer works. We did not test 2.1.6.

fritzmg commented 3 years ago

Yeah, this is actually deliberate. Otherwise every page could be printed with the GET parameter, even though it was not enabled. This is not intended nor desirable. I changed it so that PDF printing only works if you enabled it in the article or a share buttons content element. But I think it is feasible to expand the check to a share buttons module included in the page layout.

grashalm4u commented 3 years ago

Hello Fritz, I am the customer of Aybee... yes, thank you very much, that would be great. Otherwise we would have to manually activate all articles in the backend.

grashalm

Aybee commented 3 years ago

But I think it is feasible to expand the check to a share buttons module included in the page layout.

👍 Yes, that would be great as the pdf syndication doesn't exist in the latest Contao versions.

grashalm4u commented 1 year ago

Hello Fritz,

here is grashalm again. i am the customer of aybee. is it now possible to select the pdf button in the sharebuttons extension module to integrate the module in the layout? I don't see the pdf button there. So I can't select it to display under every page in the layout. all other 10 elements are displayed and also work. what is special about me: i use a self-created png graphic for these 11 elements and the pdf button is the third from last. however, I'm not sure if this fact contributes to the pdf button not being displayed.

in our previous thread, aybee wrote: "Unfortunately, the PDF generation now only works if the option is checked in the article. The customer uses the sharebutton module included in the layout, to show them page wide."

and you replied with: "Yeah, this is actually deliberate. Otherwise every page could be printed with the GET parameter, even though it was not enabled. This is not intended nor desirable. I changed it so that PDF printing only works if you enabled it in the article or a share buttons content element. But I think it is feasible to expand the check to a share buttons module included in the page layout."

my question: could you extend the check for the sharebuttons module - integrated in the page layout?

i use the latest version of your extension and contao 4.13 (as of today). if it works, do i still need the tcpdf or dompdf extension?

it would be great if you could help me here, because i haven't been able to use the pdf function for about 2 years now...

you can see it on my page https://die-schreibmaus.de

Many thanks and best regards, grashalm