Page 1 of 1

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

Posted: Thu Mar 12, 2009 5:56 pm
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?

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

Posted: Thu Mar 12, 2009 5:59 pm
by tyman00
Try reading the Smarty manual it will help start you out with the proper syntax: http://smarty.net/docs.php

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

Posted: Thu Mar 12, 2009 6:02 pm
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?

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

Posted: Thu Mar 12, 2009 6:11 pm
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.

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

Posted: Thu Mar 12, 2009 8:23 pm
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}



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

Posted: Thu Mar 12, 2009 8:32 pm
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.

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

Posted: Thu Mar 12, 2009 8:42 pm
by DougWare
I tried that, {get_template_vars} doesn't list any of the individual variables for each control...

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

Posted: Thu Mar 12, 2009 9:24 pm
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'}

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

Posted: Thu Mar 12, 2009 9:34 pm
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!

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

Posted: Fri Mar 13, 2009 1:48 pm
by DougWare
This fix works perfectly for me!

Thanks again for the help!