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
    {PRINTITEM}
    PRINTICON
    require_once(e_HANDLER.'emailprint_class.php');
    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.
    {PRINTITEM}
    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
    SC_BEGIN REVIEWER_VIEW_PRINT
    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;
    SC_END
    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): Jimako
Search just forum
Chatbox
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

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

  • Jimako
    Jimako  2 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.

  • Jimako
    Jimako  4 months ago

    I will be on holiday until end of November. So no answers from me until then.

  • Jimako
    Jimako  4 months ago

    After 2 days I was able to create demo of BS Magazine 01 theme:
    https://v2demo.e107.sk/magazine01/

  • Jimako
    Jimako  4 months ago

    My antivirus software blocked and disabled gitter.