Keyword

Hide extra field if value is empty

More
14 years 7 months ago #71734 by william white
Replied by william white on topic Hide extra field if value is empty
Please excuse the ning ediror as it stripped my reply
In item php and in the hack i see < div class = itemExtraFields and in the category_item.php i see< div class = catextrafields

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

More
14 years 7 months ago #71735 by ak2user
Replied by ak2user on topic Hide extra field if value is empty
Thanks for your reply.

Yes, itemExtraFields and catItemExtraFields need to be fine tuned.

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

More
14 years 6 months ago #71736 by anntaj
Replied by anntaj on topic Hide extra field if value is empty
Hi,

I have tired all of these suggetions and I see no change at all - what could I be doing wrong?

Thanks
Ann

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

More
14 years 6 months ago #71737 by ak2user
Replied by ak2user on topic Hide extra field if value is empty
Here is a reply to this question I gave on another forum and a user reported successfully implementing these instructions. The editor here strips code so I attach it as a text file:
Attachments:

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

  • Visual Impact Web Design
  • Visual Impact Web Design's Avatar
  • Offline
  • New Member
More
14 years 4 months ago #71738 by Visual Impact Web Design
Replied by Visual Impact Web Design on topic Hide extra field if value is empty
Thank you heaps for this. It worked great!!

ak2user said:Here is a reply to this question I gave on another forum and a user reported successfully implementing these instructions. The editor here strips code so I attach it as a text file:

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

More
14 years 3 months ago #71739 by michael neese
Replied by michael neese on topic Hide extra field if value is empty
Thanks AK2user...I have tried almost all of the code changes throughout this thread, but it wasn't till I referred to your post that everything finally clicked with all issues handled...thanks again for continuing till we got this correct!!!
I LOVE this forum.

ak2user said:Here is a reply to this question I gave on another forum and a user reported successfully implementing these instructions. The editor here strips code so I attach it as a text file:

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
14 years 3 months ago #71740 by Nick
Replied by Nick on topic Hide extra field if value is empty
if it doesn't work, make sure you are affecting the right template. Your K2 template can also be stored in your actual joomla template folder under html/com_k2

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

More
14 years 3 months ago #71741 by Terry Britton
Replied by Terry Britton on topic Hide extra field if value is empty
The hide unused extra field text file posted doesn't appear to work with html fields because the html output of an empty field is <a href="http://></a>. I use this instead for the if statement:

 

<?php $value_test = strip_tags($extraField->value); if(!empty($value_test)) : ?>

ak2user said:

Here is a reply to this question I gave on another forum and a user reported successfully implementing these instructions. The editor here strips code so I attach it as a text file:

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

More
14 years 3 months ago #71742 by william white
Replied by william white on topic Hide extra field if value is empty
Nice! thanks for posting

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

More
14 years 3 months ago #71743 by ak2user
Replied by ak2user on topic Hide extra field if value is empty
Yes, thanks. Although I have not tried changing code yet.

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

More
14 years 3 months ago #71744 by Next Wave, Inc.
Replied by Next Wave, Inc. on topic Hide extra field if value is empty
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.

More
14 years 3 months ago #71745 by william white
Replied by william white on topic Hide extra field if value is empty
You should edit the file that you are showing the extra fields with, usually either category_item.php or item.php.

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.

More
14 years 3 months ago #71746 by Next Wave, Inc.
Replied by Next Wave, Inc. on topic Hide extra field if value is empty
Thanks, William.  Your tip helped me find the files.  In Joomlart templates, the overrides are at /templates/ja_portfolio/html/com_k2/templates/ja_portfolio/

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

More
14 years 3 months ago #71747 by Next Wave, Inc.
Replied by Next Wave, Inc. on topic Hide extra field if value is empty
Please ignore that.  Editing the files in ja_portfolio did me no good- templates/ja_portfolio/html/com_k2/templates/default/ was the place.

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.
Attachments:

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

More
14 years 2 months ago #71748 by pihasurfer
Replied by pihasurfer on topic Hide extra field if value is empty
hi steve, did you manage to get the hack working with the k2tabber plugin? i have exactly the same problem. thanksSteve said:
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.

More
14 years 2 months ago #71749 by Russell English
Replied by Russell English on topic Hide extra field if value is empty
Absolutely brilliant, thank you very much!!

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

More
14 years 1 month ago #71750 by dompl
Replied by dompl on topic Hide extra field if value is empty
Here is a solution that someone posted already on forum. Enjoy!on your item.php k2 template file.               <h3><?php echo JText::_('Additional Info'); ?></h3>               <ul>                       <?php foreach ($this->item->extra_fields as $key=>$extraField):?>                       <?php                       $emptyValue = false;                       switch ($extraField->type) {                               case "textfield":                               case "textarea":                                       if ($extraField->value =="") $emptyValue = true;                               break;                               case "link":                                       if (strpos($extraField->value,"\"http://\"")) $emptyValue = true;                               break;                               case "radio":                               break;                               case "multipleSelect":                                       // Test already done by K2. If value is empty, this type of field does not appear.                               break;                               case "select":                                       // This type of field can't have an empty value (first item select by default)                               break;                       }                       ?>                       <?php if (!$emptyValue): ?>                       <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>                               <br class="clr" />                       </li>                       <?php endif; ?>                       <?php endforeach; ?>                       </ul>           <div class="clr"></div>         </div>

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

More
14 years 4 weeks ago #71751 by Peter Monti
Replied by Peter Monti on topic Hide extra field if value is empty
is there a way to just make each extra field its own icon? rather than having the word then the link you  just have an icon to represnt the field???? i cant seem to style each field....... please help!

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

  • Nick
  • Nick's Avatar Topic Author
  • Offline
  • Elite Member
More
14 years 3 weeks ago #71752 by Nick
Replied by Nick on topic Hide extra field if value is empty
would require some code modding.

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

More
14 years 3 weeks ago #71753 by Peter Monti
Replied by Peter Monti on topic Hide extra field if value is empty
i have like 6 fields and i need them just to show up when the field is filled in so this post resovled that....can this be done with css styling or both the styling as well as editing the item.php? I havent found anything regarding styling each field.....

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


Powered by Kunena Forum