Streamline Your Moodle Content with Generico: Adding IFrames Made Easy

Tired of wrestling with HTML every time you want to embed an iframe in your Moodle course? What if you could add rich, embedded content with just a simple line of text? Chris Richter from Moodle at Ricoshae shows us how the Generico filter plugin makes this a reality, simplifying content creation for everyone.

Why Generico for IFrames?

While you can add an iframe directly using HTML in Moodle, Generico offers a much more elegant solution. It allows content developers to embed external websites or applications without needing to touch any HTML code. This means simpler workflows, less room for error, and a more user-friendly experience for those building your courses. Generico acts as a powerful backend converter, taking normal text and transforming it into a fully functional iframe.

Getting Started: Installation

First things first, you’ll need the Generico filter plugin. You can download it from moodle.org/plugins/filter_generico. Crucially, make sure you download the version compatible with your Moodle instance. For this example, Moodle 3.6 is used.

Once downloaded, installation is straightforward:

  1. Navigate to Moodle administration > Plugins > Install plugins.
  2. Drag and drop the downloaded zip file into the designated area.
  3. Follow the on-screen prompts to complete the installation: click “Install plugin,” then “Continue,” “Continue,” “Continue,” and finally “Update database.”

And just like that, your Generico plugin is ready to go!

Selecting and Understanding a Template

With Generico installed, let’s explore its capabilities.

  1. Go to Site administration.
  2. Type “Generico” into the search bar and select “Templates.”

You’ll discover a collection of pre-created templates. We’ll focus on the “iframe page” template.

This template is identified by the key “iframe page.” The magic lies in how you use it:generico type=iframe page/generico type frame end

This simple tag, combined with your desired URL, is all it takes to embed content. The rest of the template body contains the HTML that Generico will use to render your iframe, but you don’t need to worry about that for basic usage.

Creating Your First Generico Iframe

Now for the exciting part – embedding an iframe without any HTML!

  1. Navigate to your desired Moodle course.
  2. Turn editing on.
  3. Create a new page or activity. For clarity, let’s call it “Test Iframe Page.”
  4. In the content editor, instead of using HTML, simply paste the Generico tag and your URL:generico type=iframe page/generico type frame end

Ricoshae

Notice that you’re just typing normal text; there’s no need to access the HTML editor dropdown.

  1. Save and display the page.

Voila! You’ll now see the Ricoshae website embedded within your Moodle page as an iframe.

Customizing Iframe Height

You might notice that the default iframe height isn’t always practical. The good news is you can set a global default height for all iframes included via this template, or even adjust it on a per-template basis.

  1. Go back to your Generico plugin templates.
  2. Locate the “iframe page” template.
  3. Within the template’s body, look for the width attribute (e.g., width=100%).
  4. Add or modify the height attribute. For example, to set a height of 500 pixels:<iframe width=”100%” height=”500″ …></iframe>
  5. Save the changes.

The beauty of this is that any instance where this particular template is used across your entire Moodle site will automatically reflect this height adjustment, making global changes incredibly efficient.

Exporting and Importing Templates

Chris offers a super useful bonus: the ability to export and import Generico templates. This saves you from manually recreating templates and allows for easy sharing.

To export a template:

  1. While viewing your template, click the “Bundle” button. This will download a .txt file containing the template’s code (e.g., iframe.txt).

To import a template:

  1. Go to Generico > Templates.
  2. Choose “Add a new template.”
  3. Drag and drop the exported iframe.txt file onto the “Bundle” area.
  4. Generico will automatically populate all the details for you.
  5. Simply save the template, and you’re ready to use it!

The Generico filter truly streamlines the process of adding iframes to your Moodle courses, making content creation more accessible and efficient.