- Posts: 11
COMMUNITY FORUM
Hide extra field if value is empty
- Bernd
- Offline
- New Member
Less
More
14 years 3 months ago #71724
by Bernd
Replied by Bernd on topic Hide extra field if value is empty
You need to change the item.php
Aleksandr said:Hi guys, thanks for all your time!
I've just started to use K2 and I am not that technical to understand the mod. Could you please explain what file should I change to hide the empty fields..??
Thanks!
Aleksandr said:Hi guys, thanks for all your time!
I've just started to use K2 and I am not that technical to understand the mod. Could you please explain what file should I change to hide the empty fields..??
Thanks!
Please Log in or Create an account to join the conversation.
- Bernd
- Offline
- New Member
Less
More
- Posts: 11
14 years 3 months ago #71725
by Bernd
Replied by Bernd on topic Hide extra field if value is empty
Fantastic hack, but I've the problem, that empty textareas are still visible.
Please Log in or Create an account to join the conversation.
- Marcus Baumgarten
- Offline
- New Member
Less
More
- Posts: 1
14 years 2 months ago #71726
by Marcus Baumgarten
Replied by Marcus Baumgarten on topic Hide extra field if value is empty
Hi Olivier,
I tried your code snippet to hide empty fields, but it doesn't work for me. Can you say in which position (line) you change the item.php? In my case I see the additional infos twice (see the image).
What's the problem?
BTW: the empty field is really hidden :-)
Thanx
I tried your code snippet to hide empty fields, but it doesn't work for me. Can you say in which position (line) you change the item.php? In my case I see the additional infos twice (see the image).
What's the problem?
BTW: the empty field is really hidden :-)
Thanx
Please Log in or Create an account to join the conversation.
- delvasse
- Offline
- New Member
Less
More
- Posts: 1
14 years 2 months ago #71727
by delvasse
Replied by delvasse on topic Hide extra field if value is empty
Hello Bernd,
Yes, empty textareas are still visible. Big drawback. The length of empty textareas string is 6...
We can add such a test :
if ($extraField->type == "textarea" && (strlen($extraField->value) < 7)) { $extraField->value = ""; }
before the main test : if(!empty($extraField->value))
Regards,
Bernard Delvasse
Yes, empty textareas are still visible. Big drawback. The length of empty textareas string is 6...
We can add such a test :
if ($extraField->type == "textarea" && (strlen($extraField->value) < 7)) { $extraField->value = ""; }
before the main test : if(!empty($extraField->value))
Regards,
Bernard Delvasse
Please Log in or Create an account to join the conversation.
- Jiliko.net
- Offline
- Platinum Member
Less
More
- Posts: 567
14 years 2 months ago #71728
by Jiliko.net
Replied by Jiliko.net on topic Hide extra field if value is empty
Hi Marcus,
I think you see the info twice because you have to REPLACE and not ADD the modified code to your item.php
In v2.3, in item.php, it's from line 254 to 268
Olivier
Marcus Baumgarten said:Hi Olivier,
I tried your code snippet to hide empty fields, but it doesn't work for me. Can you say in which position (line) you change the item.php? In my case I see the additional infos twice (see the image).
What's the problem?
BTW: the empty field is really hidden :-)
Thanx
I think you see the info twice because you have to REPLACE and not ADD the modified code to your item.php
In v2.3, in item.php, it's from line 254 to 268
Olivier
Marcus Baumgarten said:Hi Olivier,
I tried your code snippet to hide empty fields, but it doesn't work for me. Can you say in which position (line) you change the item.php? In my case I see the additional infos twice (see the image).
What's the problem?
BTW: the empty field is really hidden :-)
Thanx
Please Log in or Create an account to join the conversation.
- ak2user
- Offline
- New Member
Less
More
- Posts: 19
14 years 2 months ago #71729
by ak2user
Replied by ak2user on topic Hide extra field if value is empty
Hello folks,
I attempted to implement this hack. Please see attached file for details. And get exactly nothing as a result, i.e. empty fields are still displayed as empty fields, just like without the hack.
Any suggestions?
I attempted to implement this hack. Please see attached file for details. And get exactly nothing as a result, i.e. empty fields are still displayed as empty fields, just like without the hack.
Any suggestions?
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
14 years 2 months ago #71730
by william white
Replied by william white on topic Hide extra field if value is empty
Try the file by Oliver on page 1 of this post
Please Log in or Create an account to join the conversation.
- ak2user
- Offline
- New Member
Less
More
- Posts: 19
14 years 2 months ago #71731
by ak2user
Replied by ak2user on topic Hide extra field if value is empty
Apologies. The hack does work as intended for item.php. I modified item.php but was looking at the category listing, hence my previous statement.
I then applied the same modification to category_item.php and that worked as well, which is great. But there is a small problem here. Stylistic information is gone. I wonder whether I will be able to recreate it with css, or perhaps someone could alter this hack specifically for category_item.php.
I then applied the same modification to category_item.php and that worked as well, which is great. But there is a small problem here. Stylistic information is gone. I wonder whether I will be able to recreate it with css, or perhaps someone could alter this hack specifically for category_item.php.
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
14 years 2 months ago #71732
by william white
Replied by william white on topic Hide extra field if value is empty
Check the first linethis would be different than the original which was
that may be the problem
that may be the problem
Please Log in or Create an account to join the conversation.
- ak2user
- Offline
- New Member
Less
More
- Posts: 19
14 years 2 months ago #71733
by ak2user
Replied by ak2user on topic Hide extra field if value is empty
The code (that is being replaced) in item.php and category_item.php is different. As I said, the hack works fine for item.php for which it was intended. But when I apply it for category_item.php, there is a mismatch with css. So either the hack needs to be reworked specifically for category_item.php or css adjusted.
Please Log in or Create an account to join the conversation.