Results 1 to 6 of 6

Thread: Multiple default template

  1. #1
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Frage Multiple default template

    Hello
    I am developing an extension for Contao 3.2.7
    I wish I had more predefined templates in the extension folder.

    In the file tl_module.php have the code $ this-> getTemplateGroup ('my_prefix');
    Can I bring back all the files that I have inserted in the template folder extension?

    Thanks
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

  2. #2
    User Toflar's Avatar
    Join Date
    06-19-09.
    Location
    Lyss, Switzerland
    Posts
    170

    Default

    Why would you want to do that?
    Regards

    Yanick - Contao core developer @terminal42 gmbh

  3. #3
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default

    I would like to provide you with the extension of more than one default template.
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

  4. #4
    User Toflar's Avatar
    Join Date
    06-19-09.
    Location
    Lyss, Switzerland
    Posts
    170

    Default

    I don't get it really.

    Code:
    \Controller::getTemplateGroup()
    returns a group of templates with a certain prefix.
    By convention front end modules all start with "mod_", form templates with "form_", back end templates with "be_" etc.

    The method combines the templates from all the extensions with those you specified in your "TL_ROOT/templates" folder.
    So if you have a front end module named "my_module" you probably want to name your templates "mod_my_module_default" and "mod_my_module_special" and call
    Code:
    \Controller::getTemplateGroup('mod_my_module')
    in your module settings so one can see all the templates that are related to your module. If I add a "mod_my_module_extraspecial" template to my "TL_ROOT/templates" folder, I will automatically get that one as a choice in the drop down.
    Regards

    Yanick - Contao core developer @terminal42 gmbh

  5. #5
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default

    Thanks for the reply.

    I wanted to insert more than one template in the extension folder.

    I will follow your advice
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

  6. #6
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default

    I found the solution for my needs.

    In the file config\autoload.php I recorded all the templates that I want to add

    Code:
    /**
     * Register the templates
     */
    TemplateLoader::addFiles(array
    (
    	'mod_my_template' => 'system/modules/dev_module/templates/module',
    	'mod_my_template_special' => 'system/modules/dev_module/templates/module',
    	'mod_my_template_special_second' => 'system/modules/dev_module/templates/module',
    	
    ));
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •