FrontEndUser : get name of form element in templates?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
simb
Forum Members
Forum Members
Posts: 26
Joined: Fri Apr 21, 2006 8:17 pm

FrontEndUser : get name of form element in templates?

Post by simb »

Hi,

I want to use the FrontEndUser module and customize the included module templates therefor.
Unfortunally I can't find a way to get out the name or id of the field in the loop in the change settings template. I need it to put a label in front of it.
I even can't find the right place in the code to patch it.  :-[

Any hints or ideas?

Greetings
simb
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: FrontEndUser : get name of form element in templates?

Post by calguy1000 »

Well,  it may be possible without a code change.

Field names are prefixed with the page id when their generated, and if the page id is available in smarty, then you can generate the label yourself.

I'd add {get_template_vars} into the top of the template, and see what smarty variables are available.

Then do a view source of the page, and see what the generated field name is.  something like m1blahblah
if you can match up the "m1" part with a smarty variable, then you can add the label easily.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
simb
Forum Members
Forum Members
Posts: 26
Joined: Fri Apr 21, 2006 8:17 pm

Re: FrontEndUser : get name of form element in templates?

Post by simb »

thanks calguy1000 for the reply.

Unfortunally, I don't understand your hint very well or maybe I couldn't explain my problem good enough.

Here is it more detailed
I want to modify the change settings template. In it, I have a loop:

Code: Select all

{foreach from=$controls item=control}
  {$control->hidden}<label for="">{$control->prompt}{$control->marker}</label>{$control->control}<br/>
<div class="hint">{$control->addtext}</div>
 {/foreach}
as you see, I want to put a in front of each form element. The syntax is to say

Code: Select all

<label for="nameofthelementtolabel">Labeltext</label>
My problem is, that I can't find the variable which contains the name, as it is already in {$control->control} included.
Did I miss the variable? {get_template_vars} didn't help.

Your help is very welcome!
simb
simb
Forum Members
Forum Members
Posts: 26
Joined: Fri Apr 21, 2006 8:17 pm

SOLVED: FrontEndUser : get name of form element in templates?

Post by simb »

I was able to find the right place in the code at line 4548 in file FrontEndUsers.module.php

Code: Select all

...
      //output the name of the elements to use e.g with labels
      $onerow->myelemname = $id.'input_'.$prop['name'];

      array_push( $rowarray, $onerow );
    }
...
This way I have the additional variabel "myelemname" to use in the template:

Code: Select all

...
{foreach from=$controls item=control}
  <div class="formline">{$control->hidden}<label for="{$control->myelemname}">{$control->prompt}{$control->marker}</label>{$control->control}<br/>
{if $control->addtext != ""}
<div class="hint">{$control->addtext}</div>
{/if}
</div>
 {/foreach}
,,,
maybe it helps someone else also.

greets
simb
Post Reply

Return to “Modules/Add-Ons”