Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\wamp\www\lib\weblib.php on line

Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\wamp\www\lib\weblib.php on line

by John Lu -
Number of replies: 1

I'm trying to output the full course name using html_writer.

Here is my code:

$coursename = format_string($course->fullname);

1. $output .= html_writer::div($coursename, array('class'=>'coursenametitle'));

-> This one will show error Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\wamp\www\lib\weblib.php on line 


2. $output .= "<div class='coursenametitle'>".$coursename."</div>";

-> This one is fine, however I am not following the moodle coding convention.


Average of ratings: -
In reply to John Lu

Re: Warning: htmlspecialchars() expects parameter 1 to be string, array given in C:\wamp\www\lib\weblib.php on line

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

html_writer::div($coursename, 'coursenametitle');