<if !empty($memprofile['fid3']) then>
<tr>
<th class="trow1">Gender: {$memprofile['fid3']}</th>
</tr>
</if>
<if !empty($memprofile['fid1']) then>
<tr>
<th class="trow1">Location: {$memprofile['fid1']}</th>
</tr>
</if>
<tr>
<if !empty($memprofile['fid4']) then><th class="trow1">Motto: {$memprofile['fid4']}</th></if>
This doesn't want to work. If the user has the fields filled in on his profile and he views his own profile then it will show him the fields. However, if another member views his profile then it will not show the fields.
As far as I know you cannot have conditionals in "normal" HTML. You can embed some javascript and php code, but that is somewhat different.
I am using the PHP in templates plugin.
Mhhhhh....
I think that is not possible using PHP in HTML, but HTML in PHP yes!
Therefore:
<?php
if(! empty($memprofile['fid3'])) ?>
<tr>
<td class="trow1">Gender: <?php {$memprofile['fid3']} ?> </td>
</tr>
<?php if(! (empty($memprofile['fid1'])) ?>
<tr>
<td class="trow1">Location: <?php {$memprofile['fid1']} ?> </td>
</tr>
<tr>
<?php if(! empty($memprofile['fid4'])) ?>
<td class="trow1">Motto: <?php {$memprofile['fid4']} ?> </td>
Try this code
(2015-01-21, 10:01 PM)Ben_Conway Wrote: [ -> ]Didn't work.
Shows me ALL actual code, please
what template are these edits in?
also, when the fields are empty in the DB, does it mean that the variables are actually empty? if there is sanitizing or variable initialization, they are not "empty" in PHP, they are empty strings like ''
These are in the member profile template.