PDA

View Full Version : Hide custom field if there's no info


boom
10-17-2006, 02:04 AM
Is there a way to hide a personal field link when you don't have any information in that field?

In the view-link.tpl

Thanks

John Turner
10-17-2006, 08:07 AM
Hi,

If you want to hide all fields, which is empty and heaven't any default value, of a link in Link details page.
You need to open view-link.tpl file
find following code

<!-- START LINK FIELDS DISPLAY -->
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
<tr>
<td><strong>{$lang.$key}:</strong></td>
<td>
{if $link.$key}
{if $field.type eq 'textarea' AND $config.esc_codes}
{text_to_html aText=$link.$key aParagraph=true}
{elseif $field.type eq 'checkbox'}
{array_to_lang values=$link.$key}
{else}
{if ($link.$key eq $field.default) AND (($field.type neq 'textarea') AND ($field.type neq 'text'))}
{assign var="lang_key" value=$field.default}
{$lang.$lang_key}
{else}
{if ($field.type neq 'textarea') AND ($field.type neq 'text')}
{assign var="lang_key" value=$link.$key}
{$lang.$lang_key}
{else}
{$link.$key}
{/if}
{/if}
{/if}
{else}
{$lang.not_available}
{/if}
</td>
</tr>
{/foreach}
<!-- END LINK FIELDS DISPLAY -->


and replace it with

<!-- START LINK FIELDS DISPLAY -->
{foreach from=$fields item=field}
{assign var="key" value=$field.name}
{if $link.$key}
<tr>
<td><strong>{$lang.$key}:</strong></td>
<td>
{if $link.$key}
{if $field.type eq 'textarea' AND $config.esc_codes}
{text_to_html aText=$link.$key aParagraph=true}
{elseif $field.type eq 'checkbox'}
{array_to_lang values=$link.$key}
{else}
{if ($link.$key eq $field.default) AND (($field.type neq 'textarea') AND ($field.type neq 'text'))}
{assign var="lang_key" value=$field.default}
{$lang.$lang_key}
{else}
{if ($field.type neq 'textarea') AND ($field.type neq 'text')}
{assign var="lang_key" value=$link.$key}
{$lang.$lang_key}
{else}
{$link.$key}
{/if}
{/if}
{/if}
{else}
{$lang.not_available}
{/if}
</td>
</tr>
{/if}
{/foreach}
<!-- END LINK FIELDS DISPLAY -->

tsands
11-13-2006, 05:35 AM
Hi John,

Is this mod possible for v2.0?

Greg
01-06-2007, 04:10 PM
Hi John,

Is this mod possible for v2.0?

Would like to know this also.

Dave Baker
01-06-2007, 07:15 PM
I posted solution for similar problem here(Pro 2.0):
http://www.esyndicat.com/forum/post53587-4.html

Greg
01-06-2007, 08:06 PM
Thanks Dave :)

bunny
01-06-2007, 08:32 PM
Ok to be frank guys i am getting tired of seeing :
bunny, you do not have permission to access this page. This could be due to one of several reasons:

Can someone freaking look into the freaking ticket system ? Really pissed off right now. For i have paid on 25th and still no access on forums.

Dave Baker
01-06-2007, 08:37 PM
bunny please check it:
http://www.esyndicat.com/forum/about6327.html

dpeterson
01-19-2007, 01:27 AM
I posted solution for similar problem here(Pro 2.0):

Dave, I tried your fix and the values for fields are gone but the field names are still there. Is there anyway to remove the field names also?

Greg
01-19-2007, 02:15 AM
Dave, I tried your fix and the values for fields are gone but the field names are still there. Is there anyway to remove the field names also?

I noticed the same. "Not Available" is gone but the field names (title) are still there.

John Turner
01-19-2007, 08:58 AM
Hi there,

I have fixed my previous post please check.
All fields which has empty value isn't displayed.

This worked for V2.0.x

dpeterson
01-19-2007, 05:15 PM
Almost there, but its removing the all of the custom field names. Check out this link:

http://www.hopehavengospelmission.org/Resource-Directory/food-banks-and-pantrys/maine/community-free-baptist-pantry-sabattus-l66.html

I was assuming that the first fix was for version 2

Greg
01-19-2007, 05:34 PM
Almost there, but its removing the all of the custom field names. Check out this link:

http://www.hopehavengospelmission.org/Resource-Directory/food-banks-and-pantrys/maine/community-free-baptist-pantry-sabattus-l66.html

I was assuming that the first fix was for version 2

I think John posted the wrong code for 2.0 version.
The view-link.tpl has changed from 1.2 version

See my post here near the bottom:
http://www.esyndicat.com/forum/showthread.php?p=56242#post56242

dpeterson
01-19-2007, 05:44 PM
Thanks Greg, That worked great.

Greg
01-19-2007, 06:02 PM
You're welcome :)

nevershoppedout
05-03-2007, 09:51 AM
could someone please provide the code to do this in link_display.tpl? I am not using link_view but really need this for link_display.

Dave Baker
05-05-2007, 12:04 AM
Hello nevershoppedout,
Please try it:
***Open templates/yourTemplate/link-display.tpl and find code****

<div class="description">{if $config.html_tags}{$link.description}{else}{$link. description|escape:"html"}{/if}</div>
<div class="url">{$link.url}</div>

***Replace with***

{if $link.description neq ''}<div class="description">{if $config.html_tags}{$link.description}{else}{$link. description|escape:"html"}{/if}</div>{/if}
{if ($link.url neq "http://") OR ($link.url neq '')}<div class="url">{$link.url}</div>{/if}

***Save Changes***

nevershoppedout
05-06-2007, 03:30 AM
Thank you dave :)

Dave Baker
05-06-2007, 04:54 PM
You're welcome nevershoppedout! :)

4links
07-10-2007, 05:48 AM
Is this mod for hiding custom fields when there is "no info", still valid for ver. 2.1.03 pro.

Thank you.

Dave Baker
07-16-2007, 05:52 AM
Hello 4links,
Yes it's valid, please follow Greg's link in the post #13 :)