Thread Starter
Islo
(@nuytun)
Hi
Does anyone know where the code below might be placed to get the % score results to show on the category line?
I found the % code:
<span style="width: <?php echo $scale->getValueAsRatio()*100 ?>%"></span>
I am not sure where or how to place it.
Here is the code snippet from getresults.php:
<?php if ($isShowScales): ?>
<?php foreach ($scales as $i => $scale): /* @var $scale WpTesting_Model_Scale */ ?>
<h3 class="<?php echo $scale->getCssClass($i) ?> title"><?php echo $scale->getTitle() ?></h4>
<div class="<?php echo $scale->getCssClass($i) ?> scores">
<?php echo $scale->formatValueAsOutOf() ?>
</div>
<div class="<?php echo $scale->getCssClass($i) ?> meter">
<span style="width: <?php echo $scale->getValueAsRatio()*100 ?>%"></span>
</div>
<div class="<?php echo $scale->getCssClass($i) ?> description"><?php echo $renderer->renderWithMoreSplitted($renderer->renderTextAsHtml($scale->getDescription())) ?></div>
<?php endforeach ?>
<?php endif ?>
Thread Starter
Islo
(@nuytun)
Ok, found the solution:
Find the file get-results.php
(in the folder: :src/Template/Test/Passer/get-results.php)
take this line:
<?php echo $scale->formatValueAsOutOf() ?>
and change it to this:
<?php echo $scale->formatValueAsOutOf() . ” – ” . $scale->getValueAsRatio()*100 . “%”; ?>
The percentage will now be displayed after the score on the results page.