Keyword

call extra field one k2 module & show that

  • mahdi
  • mahdi's Avatar Topic Author
  • Offline
  • Junior Member
More
11 years 9 months ago #107862 by mahdi
i want to call k2 extra field to one of k2 module to show that. about this work ther are 1 code one of that is k2 defult code & working right just in k2 component & do not work in my module:

<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="itemExtraFields">
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>

whene add this to my module give this error : Fatal error: Using $this when not in object context in /opt/lampp/htdocs/worldnews/templates/sj_worldnews/html/mod_sj_megak2news/theme1.php on line 70

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum