How to add print option to any plugin / Tip and tricks / Forums

  • Adding print options has 2 parts: 1. add button with option /link to print displayed page 2. solve printing itself.

    Adding print button

    Already existing print button in core: news: -
    new way
    {PRINTICON} {PRINTICON: class=btn btn-default} forum: -
    semiold way
    return emailprint::render_emailprint($plugin_name, $record_id, 2, $parm);
    note: this shortcode can be used only for news. There are attemps to make it as general solution, but it's not finished, print.php still counts of text "plugin" in first parameter.
    using single shortcode 
    {PRINT_ITEM=Print^plugin:forum. $record_id}
    for any of this way link for printing is created this way: href='".e_HTTP."print.php?".$print.".".$record_id."' where $print is 'news' or plugin:$plugin_name For custom plugin is maybe better direct method (
    old way
    ) Note: I don't see point to call shortcode, then template for next shortcode inside. Example: {REVIEWER_VIEW_PRINT} - custom shortcode
    global $reviewer_reviewer_ep;
    $reviewer_print .= " <a href='../../print.php?plugin:reviewer.$reviewer_reviewer_ep' title='" . REVIEWER_V022 . "'><img src='" . e_IMAGE . "generic/" . IMODE . "/printer.png' style='border:0;' alt='" . REVIEWER_V022 . "' /></a>";
    return $reviewer_print;
    Note: There is still used ICONPRINT with path THEME."images/".ICONPRINT or e_IMAGE_ABS."generic/printer.png"; and hardcoded glyphicon icons: <span class='glyphicon glyphicon-print' aria-hidden='true'></span>

    Printing itself

    Printing is managed by print.php file. Each printable plugin has to have e_emailprint.php addons. Function print_item() defines what is printed. News are exception, news are reading directly in print.php and news_template is used for output. Print.php can use THEME.'print_template.php' there is no core print_template.php file. If template doesn't exist, it just display print content with white background and button with window.print(). Note: old Reviewer plugin is example of fully customized solution for plugin with printing option.
Moderator(s): CaMer0n, Jimako
Search just forum
You must be logged in to post comments on this site - please either log in from the Login box or from here.

  • Jimako
    Jimako  1 month ago

    testing new magic shortcodes, so any weird breadcrumbs are an intention

  • Jimako
    Jimako  2 months ago

    Just playing with google custom search. It's searching this site, and github with e107 in repository name.

  • Jimako
    Jimako  3 months ago

    If you use any my theme: with version 2.2.0 there are core changes - comments and social icons - if you find problem, just tell me.

  • Jimako
    Jimako  6 months ago

    @wrxxy I am ill, sorry cant log in gitter from mobile. Try ask at main room, nothing except update was changed.

  • Jimako
    Jimako  7 months ago

    @wrxxy I got notification from gitter but I am off until Monday. I am not able to log in gitter. Answer is add it to existing gitjub issue.