WordPress.org

Forums

WP Survey And Quiz Tool
ol tag doesn't seem to be working...=( (2 posts)

  1. Khairul
    Member
    Posted 2 years ago #

    Hello everyone,

    I've been tweaking the code for the review.php page and I'm stuck at the listing of an ordered list (ol tag) to list the answer options in small alphabets. The browser (FF4, Safari, etc) ain't displaying it as alphabets, but in the default numbers.

    Code's a bit different than the default, cause I preferred the scores to be displayed at the top of the page, before the list of questions - and some other tweaks, like numbered questions. Here's what I've got:

    <?php
    $currentPoints = 0;
    $totalPoints = 0;
    $qNumber = 1;
    ?>
    	<?php foreach ( $_SESSION['wpsqt'][$quizName]['quiz_sections'] as $section ){ ?>
    		<!--<h2><?php echo $section['name']; ?></h2>-->
    		<?php
    			if (!isset($section['questions'])){
    				continue;
    			}
    			foreach ($section['questions'] as $questionKey => $questionArray){ ?>
    			<?php if ($questionArray['section_type'] == 'multiple'){
    					if ( isset($section['answers'][$questionKey]['mark']) && $section['answers'][$questionKey]['mark'] == 'correct' ){
    						$currentPoints += $questionArray['value'];
    					}
    					$totalPoints += $questionArray['value'];
    				?>
    			<?php } else { continue; } ?>
    		<?php } ?>
    		<p style="font-size:2em;text-align:center;display:block;">You've got <span id="total_points" style="font-weight:bold;"><?php echo $currentPoints; ?></span> out of <!--<?php echo $totalPoints; ?> for --><?php echo $section['name']; ?></p>
    		<?php foreach ($section['questions'] as $questionKey => $questionArray){ ?>
    			<br /><span style="font-weight:bold; font-size:1.2em; color:black;">
    				<span><?php echo $qNumber;?>. <?php print stripslashes($questionArray['text']); ?></span>
    				<?php $qNumber++; ?>
    			</span><br />
    			<?php if ($questionArray['section_type'] == 'multiple'){ ?>
    				<span class="answer_given"><b>Answer given was <?php if (isset($section['answers'][$questionKey]['mark'])) { echo $section['answers'][$questionKey]['mark']; } else { echo 'incorrect'; } ?>.</b>
    					<ol type="a">
    						<?php foreach ($questionArray['answers'] as $answer){ ?>
    							  <li><font color="<?php echo ( $answer['correct'] != 'yes' ) ?  (isset($section['answers'][$questionKey]['given']) &&  in_array($answer['id'], $section['answers'][$questionKey]['given']) ) ? '#E60000' :  '#000000' : '#669900' ; ?>"><?php echo stripslashes($answer['text']) ?>
    							  </font>
    							  <?php if (isset($section['answers'][$questionKey]['given']) && in_array($answer['id'], $section['answers'][$questionKey]['given']) ){ ?> - Your Answer<?php }?></li>
    						<?php } ?>
    					</ol>
    				</span>
    			<?php } else { continue; } ?>
    		<?php } ?>
    	<?php } ?>

    *needs enlightenment! =D

    Thank you for this awesome plugin!!

    Khai
    http://wordpress.org/extend/plugins/wp-survey-and-quiz-tool/

  2. Backie
    Member
    Plugin Contributor

    Posted 2 years ago #

    I can't see anything wrong with it. If your HTML isn't working it's a browser/html issue.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic