Keyword

links in additional fields

  • German Levi
  • German Levi's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 1 month ago #147784 by German Levi
links in additional fields was created by German Levi
I use links in additional fields. Whether these close links "rel=nofollow" ?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #147786 by Krikor Boghossian
Replied by Krikor Boghossian on topic links in additional fields
You can add it in your template overrides with a preg_replace() function or with a simple jQuery script using the attr() function.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • German Levi
  • German Levi's Avatar Topic Author
  • Offline
  • Premium Member
More
9 years 1 month ago #147790 by German Levi
Replied by German Levi on topic links in additional fields
<!-- Item extra fields -->
  <div class="itemExtraFields">
    <h2><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h2>
    <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; ?>"> <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li>
    <?php endif; ?>
  <?php endforeach; ?>
</ul>

I understand that this piece of code in the file item.php displays additional fields!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 1 month ago #147858 by Krikor Boghossian
Replied by Krikor Boghossian on topic links in additional fields
You understood correctly.
One thing first. ALWAYS use overrides.
getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

Now you can replace the <li> with this:
<?php if($extraField->value): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span> <span class="itemExtraFieldsValue">
	<?php if($extraField->type == 'link'): ?>
	<?php $output  = str_replace('<a ' , '<a rel="nofollow" ' ,$extraField->value); ?>
	<?php echo $output; ?>
	<?php else: ?>
	<?php echo $extraField->value; ?>
	<?php endif; ?>
</span> </li>
<?php endif; ?>

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum