Filters: Generico Filter

Maintained by Picture of Justin HuntJustin Hunt
Generico is a simple filter for creating templates of code snippets and text that can be inserted into Moodle text areas.
1336 sites
49 fans
Current versions available: 2

Generico is a simple templating filter, that allows you to set up text and code snippet templates for use in Moodle text areas. It allows an unlimited number of templates to be registered. When Moodle encounters a Generico filter string it will use the data in the filter string to fill out the template, and insert it into the page. See it in action on the Generico course on the PoodLL demo site.

It is useful for ad-hoc template purposes where writing a new plugin would be overkill, or just for re-using common pieces of text. It can be used to centralise and manage the embedding of iframe content from video hosting services, and educational app providers.

In the latest version there are approx. 20 presets from which you can make templates. They include templates for an info box, tabset, accordian, lightbox and image gallery. And there is a companion Atto editor plugin for Generico. The combination of these two features make it possible to use Generico like the Wordpress shortcode plugins.

This 8 minute video walks through the basic Generico Filter and should give you a good idea of what it is, and how it works. 

How it works

Templates for use with the filter are available at:

Site Administration -> plugins -> filters -> Generico -> templates

A template primarily consists of a "key", a "template," and some "defaults." (It can also load CSS and Javascript. But for now lets keep things simple.)

The key is just a one word name, that tells Generico which template to use. 

The template is just passage of text that you want to use, and the parts of the template that you want to mark as variables you surround in @@ marks.

The defaults are a comma delimited list of variablename=value pairs. It is possible to specify multiple values for a single variable in the defaults. The Generico Atto editor plugin will display these values in a drop down list. eg size="100|120|140".  The first of the values will be the true "default."

Here is an example template.

templatekey: wildthings

template: Inside this box are @@thing1@@ and @@thing2@@

template defaults: thing2=Silly

A possible filter string for this "wildthings" template would look like this:


Generico would replace the above filter string with:

"Inside this box are Sally and Silly"

The filter string must follow this format,


The wildthings example above is trivial of course. Instead imagine using it to embed YouTube videos by registering the standard iframe code YouTube gives you, as a template. Then it would only be necessary to insert the id of the video in a generico filter string and the template would do the rest. e.g



Generico comes with about 20 template presets. By default they are not set up as templates yet. To create the actual template:

  1. Open an empty template settings page
  2. Select a preset from the dropdown list at the top of the page
    This will fill in the fields on the template settings page.
  3. Press the "Save Changes" button at the bottom of the page.


So that people can share the templates they have made, there is a system to share them called "bundles." On each template settings page there is a green bundle box.

If you click on the box, it will automatically download the "bundle" as a text file. If you then drag that bundle (or somebody else's bundle) onto the green bundle box of another template, it will fill the fields on that template settings page. Be sure to save the template after you have done that.

There are a number of bundles that people have shared over in the this forum thread.

And there is a special category here on the Moodle plugins directory for sharing templates:


It is also possible to add user profile variables to your templates. Just make the first part of the variable name USER: and the next part the name of the user profile field. It also works with custom profile fields. There are two "special" user profile fields, picurl and pic that respectively output the url of the user's profile pic, and their picture itself.


User's first name: @@USER:firstname@@

User's ice cream preference (custom profile field): @@USER:icecreampref@@
Users profile pic url: @@USER:picurl@@

User's profile pic:  @@USER:pic@@


Generico installs like any Moodle plugin. Please see here for more information on that process:

On the final page of the installation you will be able to register templates. its best to skip that step, and just press "save changes." Later you can do this from the Generico template settings pages.

After installing you will need to enable the Generico filter. You can enable the Generico filter at:

Site Administration -> plugins -> filters -> manage filters

More Documentation


Screenshot #0
Screenshot #1


Picture of Justin Hunt
Justin Hunt (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS


  • Picture of Justin Hunt
    Fri, Jul 25, 2014, 5:25 AM
    Right now there are no settings that would make something like that work. The most minimal template, would still be a it wordy
  • Picture of Sebastian Gendry
    Fri, Feb 6, 2015, 4:29 AM
    I love this plugin! It's very simple to use and extremely handy.

    I have a question about

    {collapsible}[read more...]
    Your text/HTML here.

    This code hides the content by default. Is there a way to have it open, e.g., open="yes/no"?
  • Picture of Justin Hunt
    Fri, Feb 6, 2015, 9:00 AM
    Hi Sebastien,
    I think you are referring to the "toggle" preset? So something like:
    {GENERICO:type="toggle" text="read more .."}
    blah blah blah blah

    You would just alter the template where it says:

    To be open by default always ... you would change it to this:

    To have a template variable which allows you alter the default when adding the string:
    And then in the template defaults add:

    "yes/no" could work but you would have to write some javascript to turn yes and no into "block" and "none." Its simpler to just remember: none or block

    In the toggle example I tried to give a simple example of using YUI from a template. It would certainly be possible to add a "supertoggle" with easy to set defaults and animation etc. But then it wouldn't be a simple example ...
  • Picture of Justin Hunt
    Fri, Feb 6, 2015, 9:07 AM
    GASP. Moodle stripped out my code examples. Let that be a warning to ye all. Post in the forum if possible.
  • Picture of Sebastian Gendry
    Tue, Mar 10, 2015, 4:43 AM
  • Picture of David Swan
    Thu, Jun 18, 2015, 10:39 PM
    Hi will there be a version released for moodle 2.9 once I install this i get syntax error "unexpect end of line" when trying to get into site adminstration.
  • Picture of Justin Hunt
    Sun, Jun 21, 2015, 2:14 PM
    David. I posted also in the forum where you were introduced to Generico. So I think maybe you have moved on anyway. But I have tested Generico on Moodle 2.9 without any issues. Are you sure that error is coming from Generico? If you remove Generico, did he error go away? If so it could have been a failed FTP upload. I would try to upload Generico again and see if the problem clears up.
  • Picture of Vernon Spain
    Fri, Jul 31, 2015, 9:19 AM
    Awesome plugin... Saves so much time
  • Picture of Jeff White
    Thu, Sep 17, 2015, 2:33 AM
    awesome plugin! I have found so many uses for this plugin but feel free to call me an idiot for asking this. Is it possible for this plugin to query tables within moodle? Like tell it to show list the teachers of a course, show teachers picture in their profile, etc?
  • Picture of Justin Hunt
    Thu, Sep 17, 2015, 10:17 AM
    No it is not possible. It does not offer anyway to add custom data sources like that. As a template author your are basically limited to what you can do with html/JS and CSS. Maybe one day ..
  • Picture of dan k
    Tue, Nov 17, 2015, 11:24 AM
    can i increase the number of templates from 20 to 60?
  • Picture of Justin Hunt
    Tue, Nov 17, 2015, 11:58 AM
    Not from the user interface(yet). But it is possible by editing the code a little.
  • Picture of dan k
    Tue, Nov 17, 2015, 12:26 PM
    Thanks but that reply didn't really help hehehe... ;)

    is it by changing the following line:


    on the lib.php?

    I've done that and it does give me more templates, but when i use any templates above 20 after setting it all up, the {generico code returns blank.

    am i missing something?
    can you help me?

  • Picture of Justin Hunt
    Tue, Nov 17, 2015, 12:38 PM
    that is basically what I meant. For the sake of easily implementing it in the future I put that constant in place. But I have not tested it how that would work. It might be necessary to bump the plugin version number, and go through the upgrade. I don't really like advising people to do something like that without even being sure it will work myself though. I will try later today and see
  • Picture of dan k
    Tue, Nov 17, 2015, 12:46 PM
    Thanks i really appreciate any help, as i've ran out of templates and i really need a few more to keep going with my moodle install, so if you can update me with your findings later on i'll really appreciate, as i don't really have time to wait for a new update of the plugin.

Please login to post comments