Hi,
I'm using link code example from Moodle Output API documentation to create link on my page, but I'm getting constructor error.
This example
$link = new action_link();
$link->url = new moodle_url('http://domain.com/index.php', array('id' => 2, 'action' => 'browse')); // required, but you can use a string instead
$link->text = 'Browse page 2'; // Required
echo $OUTPUT->link($link)
looks like this in my case:
$link = new action_link();
$link->url = new moodle_url('/mod/book/tool/validator/bcindex.php', array('id' => $book->id, 'chapterid' => $chapter->id));
$link->text = 'validate chapter'; // Required
And it gives me the following error:
Coding error detected, it must be fixed by a programmer: PHP catchable fatal error
Error code: codingerror
- line 393 of /lib/setuplib.php: coding_exception thrown
- line 952 of /lib/outputcomponents.php: call to default_error_handler()
- line 89 of /mod/book/tool/validator/bindex.php: call to action_link->__construct()
And if I use this example:
$link = html_link::make(new moodle_url('http://domain.com/index.php', array('id' => 2, 'action' => 'browse')), 'Browse page 2');
I get the following error:
Fatal error: Class 'html_link' not found in /Applications/MAMP/htdocs/moodle/mod/book/tool/validator/bindex.php on line 92
Any help would be appreciated, thanks!