html writer
From MoodleDocs
Moodle has a class called html_writer which allows you to output basic HTML tags. This is typically used within renderer functions (or by naughty people in scripts which are outputting content without using a renderer).
There is no documentation for most of this class. Please look at the source code.
div, span methods
Moodle 2.5
To allow shorter code when outputting the div and span tags with classes, div
and span
methods were added in Moodle 2.5.
Example usage:
$out .= html_writer::div('anonymous'); $out .= html_writer::div('kermit', 'frog'); $out .= html_writer::start_span('zombie') . 'BRAINS' . html_writer::end_span(); $out .= html_writer::div('Mr', 'toad', array('id' => 'tophat');
This will result in the following HTML from each line:
anonymous
kermit
BRAINS
Mr
For detailed usage information, see the source code.