Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Moodle 3.x Developer's Guide

You're reading from   Moodle 3.x Developer's Guide Build custom plugins, extensions, modules and more

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781786467119
Length 368 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jaswant Tak Jaswant Tak
Author Profile Icon Jaswant Tak
Jaswant Tak
Ian Wild Ian Wild
Author Profile Icon Ian Wild
Ian Wild
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting to Grips with the Moodle 3 Architecture FREE CHAPTER 2. Moodle Plugins - What Can I Plug In? 3. Internal Interfaces 4. Course Management 5. Creative Teaching - Developing Custom Resources and Activities 6. Managing Users - Letting in the Crowds 7. Creating a Dashboard - Developing a Learner Homepage 8. Creating a New Skin 9. Moodle Analytics Appendix

Templates


So far, we have been building HTML in renderer functions. Generating pages in this way is great for the developer but it can make life harder for the theme designer. Renderers can contain lots of logic that the theme designer wouldn't necessarily be interested in and this can make developing new formats much more difficult. Templates provide much better separation between the presentation layer and the business layer, which we shall see in this section.

Let us revisit the Courses information block description page. Recall that this displays an overview of the course:

This page is generated by the get_overview() function implemented in renderer.php. Let us re-implement this page so that it uses a Mustache template.

Mustache

This section only gives a very brief overview of Moodle templates. The templating technology employed is called Mustache (pronounced moo-stash not moo-starsh... and definitely not moo-stosh). For more details on Moodle's use of Mustache, check out the Moodle developer...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image