Hello all, I have a general query on an ad script I have altered. Basically, it is a little like a guestbook script...and I was wondering if there was some coding I could do, so that if a field was not filled in, it would not be shown on the index file? You can see here: http://insectstore.com/classifieds/ The "add insect add" link goes to the sign page, and you will see there are various fields to fill out. You will also see on the ads page, there are lot of ads which have blank fields in. It is these I want to be hidden, if they are not filled in. Thanks in advance!
You can certainly change the script so that it does not display placeholders for empty fields. If the field is not empty, show that bit, otherwise do not. This is easier to accomplish if the HTML for the listings is created in your script as it assembles the information from the database. It is more problematic in a template unless you are using a templating system which allows conditionals. I cannot offer more concrete suggestions without knowing how you get from the database to the page displayed to visitors.
You can do something like this, for example for the website field (but I would need to see your script to give you the exact answer) <?php if ($website) : ?> <tr> <td><b>Website:</b></td> <td><?php echo $website ?></td> </tr> <?php endif ?> PHP: (obviously you need to substitute '$website' with the correct variable name in your script, and do this for all the fields that are shown) HTH, cheers!
Okay, thanks for your input all. I will get the script when I am back at home, and show you where the origin of the index and publish file is...and give that above suggestion a go! Thanks again people.