function printSiteList($studentId) { if ($studentId == 0) { // Grabbing 10 random students $students = queryGetRandomStudents(); // See this method to chnage the number of random students // Printing Site link for each student foreach ($students as $student) { ?> <tr> <td> <a href="<?php echo getSiteLink($student['id']); ?> "><?php echo "- " . queryGetStudentName($student['id']); ?> </a> </td> </tr> <?php } } else { // Printing personal site link ?> <tr> <td> <a href="<?php echo getSiteLink($studentId); ?> "><?php echo "- " . queryGetStudentName($studentId); ?> </a> </td> </tr> <?php // Grabbing students in users group $students = queryGetGroupMembers(queryGetGroupId($studentId)); // Printing Site link for each student foreach ($students as $student) { // Making sure the users site isnt printed if ($student['id'] != $studentId) { ?> <tr> <td> <a href="<?php echo getSiteLink($student['id']); ?> "><?php echo "- " . queryGetStudentName($student['id']); ?> </a> </td> </tr> <?php } } } }
<head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $(".hidden-div-div").hide(); //$('#some').click(openHiddenDiv); }); // Opens a hidden div function openHiddenDiv(key) { // Opens the div $("#hidden-div-"+key).show(); } </script> </head> <body> <div class="hidden-div-div"> 1 </div> <div class="hidden-div-div" id="hidden-div-tva"> 2 </div> <button id="some" onclick="openHiddenDiv('tva')">Click Me!</button> <?php print_r(queryGetRandomStudents(10)); ?> </body> </html>