Relations between plugin, template file and template arrays name / Tip and tricks / Forums


  • Maybe this works this way long time but I suppose it was fixed during time, because I needed to have workaround for this.

    plugin name:  jm_download

    template file name:  jm_download_template.php

    template array name: $JM_DOWNLOAD 

    template items:  ['latest_menu']['start']

    It can be loaded 

    $template=e107::getTemplate('jm_download','jm_download');

    OR 

    $template=e107::getTemplate('jm_download','jm_download', 'latest_menu');
    First one returns all templates, second one just sets for latest_menu. 
    BUT: 

    plugin name:  jm_download

    template file name:  download_template.php

    template array name: $DOWNLOAD 

    template items:  ['latest_menu']['start']

    $template=e107::getTemplate('jm_download','download', 'latest_menu');

    So now I don't need to have boostrap and table version in one file, but I can do:

    if(deftrue('BOOTSTRAP')) // v2.x

    $template=e107::getTemplate('jm_download','bootstrap');

    }

    else $template=e107::getTemplate('jm_download','table');

    This is how it should work. And templates files could be now cleaner. 

    So template file name and template array name have to be the same (just capitalize).  Again, maybe it works this way from the beginning, but I couldn't get it works, I asked many time for this... So imagine my suprise now that it was to much easy to set :) 

    Of course, with new plugin I will do only div version, but there are old plugins with table layout...  And this can be applied for different version for bootstrap3 and bootstrap4... 

     

  • added 6.12. template array name has to name + _TEMPLATE,
     

Moderator(s):
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.If you are not registered click here to signup.


  • Jimako
    Jimako  4 weeks ago

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

  • Jimako
    Jimako  1 month ago

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

  • Jimako
    Jimako  1 month ago

    My antivirus software blocked and disabled gitter.

  • Jimako
    Jimako  1 month ago

    Again, I had to set tinymce off. It strips custom bbcodes.

  • Jimako
    Jimako  1 month ago

    Sorry, I set login off by mistake, it should be fixed now.