Instead, you should use profile field IDENTIFIERS, which are language-independent, cannot be changed, and therefore are safe to use in conditionals.
To use this, you just would need to "assign_var" the result of the call to
$cp->generate_profile_fields_template('show'...
(look in memberlist.php for an example of how this is done), and then you would have available multiple template variables:- Code: Select all
'PROFILE_XXXX_NAME' -> This is the language dependent name of the profile field
'PROFILE_XXXX_EXPLAIN' -> This is the language dependent explantation of what this profile field represents
'PROFILE_XXXX_TYPE' -> The type of the variable, as defined when the CPF was created
'PROFILE_XXXX_VALUE' -> The value of the profile field
'S_PROFILE_XXXX' -> A switch to be used in conditionals, will be true if the user has this profile field defined
In all these cases the XXXX is the fully upper-case profile field IDENTIFIER, that is language independent.
In your example above, you could use in the template things like <!-- IF S_PROFILE_DRIVES -->{PROFILE_DRIVES_VALUE}<!-- ENDIF--> assuming that 'drives" is the identifier of a certain CPF (note this is the IDENTIFIER, not the name, that might be 'Drives' in English, or 'Conduce' in Spanish... sorry no German

While I agree with 4_seven that producing the full HTML in PHP might be easier, in certain cases you will be much better off having the flexibility to use the CPFs individually, and offloading the full HTML structure to your Template file (where it actually belongs...). That way, you will also ease the work of style authors, that want individual CONTENT variables, and not markup ones, as this will limit their freedom to create new styles.
Hope this helps. Please, don't take this as contentious, but just as a generic comments on the use of CPFs... Regards,
-javiexin