Solved - Cycling Through Attributes

Permalink
Hardly a programmer but need some big help. Developed a single page and have the necessary attributes pulling. But, really stuck on this one.

I have a list of attributes in a table. And I want to cycle through the data so if there is no data in item_1 then item_2 will be the first item to display in the first row. If there is data in item_1 and item_3 then i want item_1 and item_3 to populate in an individual consecutive rows.
<td>
<?=$user->getAttribute('item_1', 'displaySanitized', 'display');?>
<?=$user->getAttribute('item_2', 'displaySanitized', 'display');?>
<?=$user->getAttribute('item_3', 'displaySanitized', 'display');?>
<?=$user->getAttribute('item_4', 'displaySanitized', 'display');?>
</td>


thanks

tracyb
 
Mnkras replied on at Permalink Reply
Mnkras
Can you show an example of how exactly you want it to look in the end, I am not fully understanding what you wrote.

Mike
tracyb replied on at Permalink Reply 1 Attachment
tracyb
Below is the display page currently it has a </br> after each instance that is why the table is so large. You will see with the record "Anthony G Putis, Jr." how he has two dates of service he was in two units. i want the the first valid data (cycling through the attributes) to populate in the first row and then the second valid data to populate in a second row. see also single page that was developed.

http://www.506infantry.org/index.php?cID=495...

u:c4studioc4
p:test1234

thanks
Mnkras replied on at Permalink Reply
Mnkras
Sorry, still a bit confused, but let me give it a shot,

you currently have:

<?=$user->getAttribute('dos_wwii', 'displaySanitized', 'display');?></br>


and you only want that to show if it has a value, what you can do, is:

<?php 
if($user->getAttribute('dos_wwii')) {
  echo $user->getAttribute('dos_wwii', 'displaySanitized', 'display') . '</br>';
}


you could also make that into a shorthand if statement if you wanted (if:then?else)

Mike
tracyb replied on at Permalink Reply
tracyb
Mike, Thank you so much!