- Posts: 30
COMMUNITY FORUM
Hide extra field if value is empty
- Next Wave, Inc.
-
- Offline
- Junior Member
I am also looking to confirm the location of the files to be edited, specifically in a Joomlart template.
Thanks!
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
You an edit them directly in the k2 core (you should find them in components/com_k2/templates/default
a Better way would be to first check to see if your template is overriding k2 templates from the start. Look in Your Site Root/Templates/Your template Name/html/com_k2/templates to see if there is anything there. If they are there edit the files there or create a new k2 template and use it. See here for more info about templating
Ken Lyle said:
Could someone please re-aggregate the status and implementation of this hack for K2 2.4.1, because the last version reference I see is Olivier's mention of 2.3.
I am also looking to confirm the location of the files to be edited, specifically in a Joomlart template.
Thanks!
Please Log in or Create an account to join the conversation.
- Next Wave, Inc.
-
- Offline
- Junior Member
- Posts: 30
Please Log in or Create an account to join the conversation.
- Next Wave, Inc.
-
- Offline
- Junior Member
- Posts: 30
Attached is the patch, including the test mentioned on page 3 of this thread, for suppressing empty textarea fields as well.
Thanks and credit to everyone who contributed.
Please Log in or Create an account to join the conversation.
- pihasurfer
-
- Offline
- New Member
- Posts: 2
I'm trying to get this work with the K2tabber plugin and I'm having some trouble. Any idea how to incorporate the hack from the previous page into this code?
<!-- ExtraField "Tabbed" by K2Tabber --> <?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?> <!-- Item extra fields --> <br /> <div id="ExtraFields"> <h3><?php echo JText::_('Additional Info'); ?></h3> <!-- Tabs start here --> <div class="simpleTabs"> <!-- Tabs Menu --> <ul class="simpleTabsNavigation"> <?php foreach ($this->item->extra_fields as $key=>$extraField):?> <li id="<?php echo $extraField->name; ?>"><a href="javascript: void();"><?php echo $extraField->name; ?></a></li> <?php endforeach; ?> </ul> <!-- Tabs Content --> <?php foreach ($this->item->extra_fields as $key=>$extraField):?> <!-- Tab --> <div class="simpleTabsContent"><?php echo $extraField->value; ?></div> <?php endforeach; ?> </div> <!-- Tabs end here --> </div> <?php endif; ?>
Please Log in or Create an account to join the conversation.
- Russell English
-
- Offline
- Junior Member
- Posts: 37
Please Log in or Create an account to join the conversation.
- dompl
-
- Offline
- New Member
- Posts: 6
Please Log in or Create an account to join the conversation.
- Peter Monti
-
- Offline
- New Member
- Posts: 7
Please Log in or Create an account to join the conversation.
- Nick
-
Topic Author
- Offline
- Elite Member
- Posts: 190
Please Log in or Create an account to join the conversation.
- Peter Monti
-
- Offline
- New Member
- Posts: 7
Please Log in or Create an account to join the conversation.
- Nick
-
Topic Author
- Offline
- Elite Member
- Posts: 190
The only solution i can think of is to create some sort of php function and a field inside the extra fields table in mysql which caries the styling. Then have php parse out the style and apply it to the actual field when it's being rendered. But that's just what i can come up with now. You can also do it with javascript but not sure how.
Please Log in or Create an account to join the conversation.
- Peter Monti
-
- Offline
- New Member
- Posts: 7
adding this line <?php $custom = $this->item->extra_fields; ?> and then addressing extra fields for the item like <?php echo $custom[1]->value;? as long as the order of the fields is static.
Please Log in or Create an account to join the conversation.
- Nick
-
Topic Author
- Offline
- Elite Member
- Posts: 190
Please Log in or Create an account to join the conversation.
- Peter Monti
-
- Offline
- New Member
- Posts: 7
wow thanks alot....ive been going nutz here
Please Log in or Create an account to join the conversation.
- Nick
-
Topic Author
- Offline
- Elite Member
- Posts: 190
pastebin.com/Fr8L6Vza
rename your old item.php to something else.
paste the code from pastebin in a new item.php
tell me the results pls :)
Please Log in or Create an account to join the conversation.
- Peter Monti
-
- Offline
- New Member
- Posts: 7
Please Log in or Create an account to join the conversation.
- Nick
-
Topic Author
- Offline
- Elite Member
- Posts: 190
tag it's own style.
Please Log in or Create an account to join the conversation.
- Peter Monti
-
- Offline
- New Member
- Posts: 7
Please Log in or Create an account to join the conversation.
- Nick
-
Topic Author
- Offline
- Elite Member
- Posts: 190
Please Log in or Create an account to join the conversation.
- Wouter
-
- Offline
- New Member
- Posts: 12
But is there a way to show only the first 4 extra fields in category view? And then show all extra fields in the item view?
I have about 15 extra fields.
Thanks in advance!
Please Log in or Create an account to join the conversation.