Filters: Generico Filter

Maintained by Picture of Justin Hunt Justin Hunt
Generico is a simple filter for creating templates of code snippets and text that can be inserted into Moodle text areas.
609 sites
36 fans
Moodle 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1

Generico is a simple templating filter, that allows you to set up text and code snippet templates for use in Moodle text areas. It will allow 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 info box, tabset, accordian, lightbox, screenr 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. 


You can define templates for use with the filter at:

Site Administration -> plugins -> filters -> Generico

A template consists of a "key", a "template," and some "defaults." 

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. 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.



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 up the template. Be sure to save the template after you have done that though.

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


It is also possible now 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@@


If you are uploading Generico, first expand the zip file and upload the generico folder into:

[PATH TO MOODLE]/filters.

Then visit your Moodle server's notifications page.

Site Administration -> Notifications

Moodle will guide you through the installation. On the final page of the installation you will be able to register templates. You can choose to skip that and do it later from the Generico settings page if you wish.

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

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


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

Show comments
  • Picture of Raimen R
    Wed, 4 May 2016, 3:17 PM
    Hi Justin,

    great work! We use Moodle v2.8 & I've downloaded the plugin from instead of github after reading your github note.

    Just double-checking, if I've more than 20 templates should it work for the version I downloaded? Your comment indicates ( the version hosted here wouldn't work.

    We'll basically use the plugin for re-using text blocks for different courses. So it's important to have the capability of unlimited template (i.e. out-of-the-box if possible).

    Could you please confirm? Thanks Justin.

  • Picture of Phuong Hoang
    Fri, 29 Jul 2016, 9:05 PM
    Thank you so much. A very useful plugin. It's worth spending time playing around.
  • Picture of Jeff White
    Fri, 11 Nov 2016, 10:31 PM
    One of the best plugins ever made. Is there like a repository for us to share things we have done using this plugin? I wouldn't mind sharing some of the filters I have managed to get working smile. Maybe someone else might find them useful with their work.
  • Picture of Justin Hunt
    Mon, 14 Nov 2016, 2:00 PM
    Hi Jeff

    Thanks for the vote!! Right now people just post them in this forum:

    I have made a few a half hearted attempts at a gallery of sorts for the plugins but was generally beaten back by life(or in one case a server crash). More recently I set up a Moodle Database activity on the PoodLL demo site, and got as far as one template uploaded and explained.

    But it is not actually the right place for this. Because it gets reset each day, so I am the only one who can really edit it permanently.
    [ .... thinking ...]
    How about we set up a special site for sharing templates on MoodleCloud? Does that sound like a good idea? (Generico itself is not installed there, but thats ok ... isn't it?)

    Its a real shame, there are some really good templates out there. Hmmmmm Perhaps we could make a generico site on Moodle cloud for this purpose? The plugin itself is not installed there, but we could use the Moodle database
  • Picture of Данияр Нугуманов
    Thu, 15 Dec 2016, 6:01 PM
    Hello. help me plz

    i dont know why page /admin/settings.php?section=filter_generico_templatepage_1 is not fully loaded

    It's happends when i am trying to edit template

    how to fix it

    Moodle 2.7.14 (Build: 20160509)
  • Picture of Justin Hunt
    Fri, 16 Dec 2016, 7:00 AM
    2.7 is quite old now. What version of the Generico filter are you using? If it's a recent version it will be using AMD which didn't come along until 2.9. The supported versions of Moodle are listed with each of the versions of Generico on the Moodle plugins page
  • Picture of Данияр Нугуманов
    Tue, 20 Dec 2016, 1:00 PM
    Justin Hunt, thank you!
  • Picture of Данияр Нугуманов
    Thu, 22 Dec 2016, 5:01 PM
    Justin Hunt, hello, i have a question about DATASET templates
    Is it possible to improve sql query like this ?

    SELECT u.firstname, u.lastname,, c.fullname FROM mdl_user u, mdl_role_assignments r, mdl_context cx, mdl_course c WHERE ( = r.userid) AND (r.contextid = AND (cx.instanceid = @@COURSE:id@@) AND (r.roleid =3) AND (cx.contextlevel =50);

    i dont understand how it make
    help me plese
  • Picture of Justin Hunt
    Fri, 23 Dec 2016, 8:47 AM
    You should really post these questions on the forum. Because other people will notice and answer or get the benefit of the answer. And I can attach templates and resources to the post, which I can't do here.

    You can not put Generico variables in the Dataset field. The syntax is just the same as for the $DB get_records_sql function.

    You put any variables in the SQL as '?' marks, and any data or variables that should take their place in the Dataset vars field.
  • Picture of Данияр Нугуманов
    Tue, 24 Jan 2017, 12:59 PM
    Hello Justin, in forum you wroute that we should set Dataset Variables, but our moodle version is not compatible with fresh version where that field have
    Moodle version 2.7

    Can you ask me what version may help us?
    If there are not, can you update plugin for 2.7 moodle?
  • Picture of Justin Hunt
    Tue, 24 Jan 2017, 10:59 PM
    Oh, thats too bad! A lot has changed in Moodle 2.9. Because Moodle started to use AMD in Javascript. It would be possible to add the Dataset variables features to the old version of Generico. But I do not have time to make those changes. From Moodle 2.9 you can use the latest version of Generico. I hope that upgrading is an option for you.
  • Picture of Carlos Chiarella
    Fri, 17 Feb 2017, 1:50 AM
    We need some help here. We upgraded the version of the plugin from 1.3.0 to 1.3.8. The plugin is now stripping out the html tags when it renders the code.

    in html view:


    Vivaldi! Il prete rosso, or “the red priest” in Italian. This was
    Antonio Vivaldi’s nickname because of his red hair and because he had
    trained to become . . . a priest! At the age of 26, he was forced to
    abandon priestly duties because of ill health.

    Perhaps leaving the priesthood allowed him to focus all of his energy on
    music. He continued to expand his reputation as an accomplished violinist,
    conductor, and a highly prolific composer.

    So virtuosic was his violin playing that a German architect who heard him
    play in 1713 stated that “it is hardly possible that anyone has ever played
    or ever will play in such a fashion.”

    "} {GENERICO:type="narration_end"}

    When the page is in view mode, the

    tags are removed. We are using Moodle 3.0.7.
    It worked before when we were using Generico 1.3.0 and Moodle version 3.0.5. Any ideas of what might be happening?

  • Picture of Carlos Chiarella
    Fri, 17 Feb 2017, 1:52 AM
    The p tags are being removed.
  • Picture of Anderson Hsu
    Mon, 1 May 2017, 10:07 AM
    Dear all,
    How can we add database connection and sql by using Generico Filter plugin as shown as the link
    Thanks a lot.
  • Picture of Georg Wiesinger
    Wed, 26 Jul 2017, 6:31 AM
    Hi, congrats for this wonderful plugin! I tried to insert a lightbox (configured from your presets) on Moodle 3.3.1 but it didn't work, nothing happens, page only scrolls to top! Any idea what I'm might doing wrong?!

    Kind regards,
1 2 3
Please login to post comments