Sackgesicht VIP
Total posts: 1,636
19 Май 2016 03:45

What is the best way to print information of a single record? Using a component, or a special full article view... ?

Последние изменения: 25 Май 2016


Jeff VIP
Total posts: 745
19 Май 2016 04:50

That's a very good question.

Personally, I would like to be able to open a custom full article view in a modal screen with a print button. Suggestions, anyone?


Sackgesicht VIP
Total posts: 1,636
19 Май 2016 05:18

I think something like a "template switcher" feature, similar to the list template functionality would be a good way to accomplish it. I will open a new topic for it with a little more details ...


Sackgesicht VIP
Total posts: 1,636
19 Май 2016 05:35

Jeff,

I have a case scenario where i used a component to create a sort of statistic/ dashboard page of a section and used a button to print the content (without menu etc).

to open the print dialog, i use following code:

<?php if (!JRequest::getVar('print', 0)): ?>
            <div style="float: right; margin-top: 0px;">
                <a href="/<?php echo JURI::root(true);?>/index.php?option=com_acstats&amp;tmpl=component&amp;print=1" title="Print"
                    onclick="window.open(this.href,'win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=900,height=600,directories=no,location=no'); return false;"
                    rel="nofollow">
                    <img src="/<?php echo JURI::root(true);?>/media/system/images/printButton.png" alt="Print"  />
                </a>
            </div>
        <?php endif;?>

Jeff VIP
Total posts: 745
19 Май 2016 06:05

Thanks!


Sergey
Total posts: 13,748
25 Май 2016 09:00

I would use tmpl=component and in full article template I would change markup if it is compoennt.

Another way is to add tmpl=print to URL, then create print.php file in template root. DO not include CSS so that tabs and sliders are all visible and only include basic styles.

Работает на Cobalt