Moodle PHP html_tag - Collapsing Course Table

Moodle PHP html_tag - Collapsing Course Table

by Kevin Lu -
Number of replies: 0

Hi Moodle Experts,

Thank you for reading this post. I am trying to create a collapse tag that can collapse my courses upon clicking. And when I click again, then collapse tag expands so I can see all my courses. This is similar to the following html code but must be done in PHP by using html_writer. I have attempted all the possible html_writer parameters like the following but none of them seems to work,


$o = $o . html_writer::div('hi', '', array('data-role' => 'collapsible'));

$o = $o . html_writer::tag('div', 'Your Mom', array('data-role' => 'collapsible'));


Could you help me out? Thank you in advance.


<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">

<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

</head>

<body>


  <div data-role="main" class="ui-content">

    <div data-role="collapsible">

      <h1>April 30, 2017 Courses</h1>

      <table>

      <tr>

        <td>6:00PM to 7:00PM</td>

            <td>Student: Andrew</td>

            <td>Tutor: Jack</td>

        </tr>

      </table>

    </div>

  </div>


</body>

</html>


Attachment collapse.png
Average of ratings: -