Include and use the html_writer class

Include and use the html_writer class

by Ben Laor -
Number of replies: 1

I have a class inside a custom plugin i'm building and i wish to use the "html_writer" class inside it.
I tried require_once on the file where the html_class is defined but i get an error "Fatal error: Class 'local_myplugin\html_writer' not found in /pathtomyclassfile/myclass.php".
Do i need to create an instance of the html_writer class?
why does it appear as though it looks for it in my plugin, do i need to extend some other class in order to use it?

Average of ratings: -
In reply to Ben Laor

Re: Include and use the html_writer class

by min wang -

html_writer is defined in moodle/lib/outputcomponents.php.  

Please try to add '

use html_writer;
' in your codes.


Cheers


Min



Average of ratings: Useful (1)