- Posts: 102
COMMUNITY FORUM
links in additional fields
- German Levi
- Topic Author
- Offline
- Premium Member
Less
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
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 1 month ago #147786
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 102
9 years 1 month ago #147790
by German Levi
I understand that this piece of code in the file item.php displays additional fields!
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
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 1 month ago #147858
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
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:
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.