Hello,
I recently started publishing some articles for the start of the high school hockey season. They look great formatted in all browsers, and on handheld wireless devices when scaled to responsive. These articles will be printed by the kids playing to keep for the scrapbooks. I notice when I hit print the formatting gets all jacked up and the images move all over the place. I've tried adding an excessive amount of line breaks to fix the printing problem but the print view doesn't recognize the breaks.
example, today's article.
youthhockeyinfo.com/index.php?page=368
Any help is greatly appreciated.
I take you mean using the browsers print option.
You would be better of using the following https://ekoopmans.github.io/html2pdf.js as this gives you more control over how it prints.
Quote from: tino on October 14, 2022, 08:39:46 PM
I take you mean using the browsers print option.
You would be better of using the following https://ekoopmans.github.io/html2pdf.js as this gives you more control over how it prints.
I click the built in TP print function, and then right click and print.
Quote from: njtweb on October 14, 2022, 09:09:50 PM
Quote from: tino on October 14, 2022, 08:39:46 PM
I take you mean using the browsers print option.
You would be better of using the following https://ekoopmans.github.io/html2pdf.js as this gives you more control over how it prints.
I click the built in TP print function, and then right click and print.
I do not see a print link on that page
Quote from: @rjen on October 15, 2022, 07:29:50 AM
Quote from: njtweb on October 14, 2022, 09:09:50 PM
Quote from: tino on October 14, 2022, 08:39:46 PM
I take you mean using the browsers print option.
You would be better of using the following https://ekoopmans.github.io/html2pdf.js as this gives you more control over how it prints.
I click the built in TP print function, and then right click and print.
I do not see a print link on that page
The print link isn't showing for guests, thank you for pointing that out! Is there a TP permission specifically for the print link?
It is not a permission, this is one of the functions that is simply not offered to guests...
Quote from: @rjen on October 20, 2022, 07:28:53 AM
It is not a permission, this is one of the functions that is simply not offered to guests...
Is there any way I can make it offered to guests? This is for high school kids to print their articles so they can put them in their scrap books. I'm fine with making a donation. Please let me know, thank you.
Are you willing to hack the code?
Quote from: @rjen on October 20, 2022, 01:24:19 PM
Are you willing to hack the code?
If I'm given instruction and its moderate level and doesn't involve modifying several pages I am, but if it's really involved I guess no, unfortunately.
In file TPsubs.template.php
find
function article_print($render = true)
{
global $scripturl, $txt, $context;
$data = '';
if($context['TPortal']['print_articles']==1) {
if(isset($context['TPortal']['article']['boardnews']) && !$context['user']['is_guest']) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?action=printpage;topic=' . $context['TPortal']['article']['id'] . '">' . $txt['print_page'] . '</a></div>';
}
elseif (!$context['user']['is_guest']) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?page=' . $context['TPortal']['article']['id'] . ';print">' . $txt['tp-print'] . '</a></div>';
}
}
and change it to
function article_print($render = true)
{
global $scripturl, $txt, $context;
$data = '';
if($context['TPortal']['print_articles']==1) {
if(isset($context['TPortal']['article']['boardnews'])) {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?action=printpage;topic=' . $context['TPortal']['article']['id'] . '">' . $txt['print_page'] . '</a></div>';
}
else {
$data .= '
<div class="article_rating"><a href="' . $scripturl . '?page=' . $context['TPortal']['article']['id'] . ';print">' . $txt['tp-print'] . '</a></div>';
}
}
It breaks, and I get this. So I changed back. Attached is the chunk I'm editing.
Youth Hockey Info
Unable to load the 'tp_above' template.
That's what happens trying to give a quick answer: there was one bracket missing...
I updated the code in previous post to the correct new code. Try that
Quote from: @rjen on October 20, 2022, 04:28:53 PM
That's what happens trying to give a quick answer: there was one bracket missing...
I updated the code in previous post to the correct new code. Try that
Perfect! Works like a charm, I greatly appreciate it. Assuming I'll have to make this edit whenever I update the mod, would this be correct?
Thank you very much as always.
Yes, with the next version any file edits will be overwritten
Quote from: @rjen on October 20, 2022, 05:25:40 PM
Yes, with the next version any file edits will be overwritten
Okay, thank you very much!