Skip to main content
Known Participant
March 8, 2010
Question

a variation on "show region" - is this possible?

  • March 8, 2010
  • 8 replies
  • 885 views

Hi all. I have a page of listings pulled from a database which uses the standard "show region is recordset is not empty" server behaviour. This is working fine and if there's no content for a particular field, then this behaviour does what it's supposed to do.

Problem is that each element of the listing has a header (title/name/description...etc etc) and I want to hide the header for any field that doesn't have any content.

OK, I know I can include the header in the table listing and then it would either show or not, depending, but ideally I need to be able to style the header differently from the listing text, and if it's coming in as {rsArtists.artName}

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Inspiring
March 8, 2010

<?php if ($row_featured_art['art_caption']!= "") { ; ?>

                    <?php echo $row_featured_comp['art_caption']; ?>

                            <?php } else { };?>

The above could be used with a bit more modification to do what you want.

if the field is NOT empty then show the field

Else show nothing

jeffmgAuthor
Known Participant
March 8, 2010

I'm pretty basic with php so bear with me, if you will - could this be modified to apply so that if I have this:

header1

element1

header2

element2

etc etc

that I can use this to stop header1 from showing if element1 is an empty record? Is that what you mean?

Inspiring
March 8, 2010

Yes.

If I give you an example:

Im not sure how you are making this

but something like this

<table width="100" border="0" cellspacing="0" cellpadding="0">
  <tr>
<?php if ($query['heading1'] != "") {?><th scope="col">Header 1</th><?php } else { };?>
    <th scope="col">Header 2</th>
  </tr>
  <tr>
    <td>bob</td>
    <td>joe</td>
  </tr>
</table>

you will need a row cound somewhere