Hello
We are creating a math site with K2 (for written lessons and video lessons) and ariquiz (for live test of course)
so we thing we can embeed related quiz in K2 article. But writing the ariquiz content plugin sniplet again and again for all articles was not easy ( at least for me). So I created an extrafield in K2 and assign it to related categories.
I copied default template of K2 and renamed it
default2(assign it to kategories) and put it in
/templates/"templatename"/html/com_k2/templates/default2
opened the item.php
find the extrafield portion and
replace it all with the code below
So in every lesson(K2 item) I only write the ID of Quiz to extrafiled and plugin does the rest. Thanks for the plugin again.
Code: |
<!-- Item extra fields -->
<div class="itemExtraFields" >
<h3><?php echo JText::_('Quiz about this lesson :'); ?></h3>
<?php
//convertArray to use ids as key
$extrafields = array();
foreach($this->item->extra_fields as $item)
{
$extrafields[$item->id] = $item->value;
}
?>
<?php if(isset($extrafields[1]) === true):?>
<div style="text-align:center;">
{ariquizanywhere quizId="<?php echo $extrafields[1];?>"}{/ariquizanywhere}
</div>
<?php else: ?>
<?php echo "NO QUIZ YET"; ?>
<?php endif; ?>
<div class="clr"></div>
</div>
|