FEUsers, want to hide hidden fields on a template [SOLVED]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
DougWare
Forum Members
Forum Members
Posts: 18
Joined: Fri Nov 07, 2008 8:50 pm

FEUsers, want to hide hidden fields on a template [SOLVED]

Post by DougWare »

I want to keep the hidden fields from adding empty rows in the table on the Change Settings template.

The default template looks like:

Code: Select all

<!-- change settings template -->
{$title}
{if $message != ''}
  {if $error != ''}
    <p><font color="red">{$message}</font></p>
  {else}
    <p>{$message}</p>
  {/if}
{/if}
{$startform}
 {if $controlcount > 0}
  <center>
  <table width="100%">
     {foreach from=$controls item=control}
  <tr>
     <td valign='top'>{$control->hidden}<font color="{$control->color}">{$control->prompt}{$control->marker}</font></td>
     <td>
       {if isset($control->image)}{$control->image}{/if}
       {$control->control}<br/>{$control->addtext}
       {if $control->required != true}
         {if isset($control->control2)}{$control->prompt2} {$control->control2}<br/>{/if}
       {/if}
     </td>
  </tr>
 {/foreach}
  </table>
  </center>
 {/if}
 {$hidden}{$hidden2}{$submit}{$cancel}
{$endform}
<!-- change settings template -->
I've tried using {if isset($control->hidden)} and {if isset($entry->hidden)}, neither seem to work.

What's the correct syntax for checking if a field is hidden or not?
Last edited by tyman00 on Fri Mar 13, 2009 2:02 pm, edited 1 time in total.
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: FEUsers, want to hide hidden fields on a template

Post by tyman00 »

Try reading the Smarty manual it will help start you out with the proper syntax: http://smarty.net/docs.php
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
DougWare
Forum Members
Forum Members
Posts: 18
Joined: Fri Nov 07, 2008 8:50 pm

Re: FEUsers, want to hide hidden fields on a template

Post by DougWare »

I think I'm pretty set on the smarty syntax, I guess the better question is...

What's the correct variable to use to check if a field is hidden?
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: FEUsers, want to hide hidden fields on a template

Post by tyman00 »

I see what you were trying to do now. I don't know off the top of my head. But this post could be of assistance for you : http://calguy1000.com/Blogs/12/60/basic ... kills.html

Pay special attention to the get_template_vars, dump and print_r part.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
DougWare
Forum Members
Forum Members
Posts: 18
Joined: Fri Nov 07, 2008 8:50 pm

Re: FEUsers, want to hide hidden fields on a template

Post by DougWare »

I don't think this is still quite what I'm looking for...

I need to know which FrontEndUsers variable (if there is one) is set to something like True or False if the property is hidden.

I'm trying to do something like this: (using quote syntax instead of code, so I can highlight my needed changes)

{$title}
{if $message != ''}
  {if $error != ''}
    {$message}
  {else}
    {$message}
  {/if}
{/if}
{$startform}
{if $controlcount > 0}
 
 
     {foreach from=$controls item=control}
{if $control->ishidden}
     {$control->hidden}color}">{$control->prompt}{$control->marker}
     
       {if isset($control->image)}{$control->image}{/if}
       {$control->control}{$control->addtext}
       {if $control->required != true}
         {if isset($control->control2)}{$control->prompt2} {$control->control2}{/if}
       {/if}
     
 
{if $control->ishidden}-->{/if}
{/foreach}
 
 
{/if}
{$hidden}{$hidden2}{$submit}{$cancel}
{$endform}


tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: FEUsers, want to hide hidden fields on a template

Post by tyman00 »

If you use get_template_vars to check the FEU variables (like outlined in that post) it should tell you what to use. If it's not there, it's not possible.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
DougWare
Forum Members
Forum Members
Posts: 18
Joined: Fri Nov 07, 2008 8:50 pm

Re: FEUsers, want to hide hidden fields on a template

Post by DougWare »

I tried that, {get_template_vars} doesn't list any of the individual variables for each control...
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: FEUsers, want to hide hidden fields on a template

Post by tyman00 »

That's where {$controls|print_r} comes in. But after speaking with the module author the hidden parameter isn't used to indicate it's hidden status, it is used to pass hidden data and information.

You will have to target each hidden field individually by name {if $control->name != 'foo' && $control->name !='foo-too'}
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
DougWare
Forum Members
Forum Members
Posts: 18
Joined: Fri Nov 07, 2008 8:50 pm

Re: FEUsers, want to hide hidden fields on a template

Post by DougWare »

Thanks....that's a good idea.  I have about 20 fields setup for both of my groups, and I only want to display 3 of them on the settings page, it should be really easy for me to match those up.  I hadn't thought about doing it that way!

Thanks!
DougWare
Forum Members
Forum Members
Posts: 18
Joined: Fri Nov 07, 2008 8:50 pm

Re: FEUsers, want to hide hidden fields on a template

Post by DougWare »

This fix works perfectly for me!

Thanks again for the help!
Post Reply

Return to “Modules/Add-Ons”