Re: [equinox69] Newbie with no clue - but want to use CMS like AutoManager

19 posts by 4 authors in: Forums > CMS Builder
Last Post: January 14, 2009   (RSS)

Sorry but ....

Can you let me know how to make fields invisible on the detail page if they are not filled out?

For example, if a section has 'name', 'age', 'location' fields and the age is not filled out, how do I prevent the 'age' field name (with nothing in that field) showing on the detail page?

Thanks!

By zip222 - January 14, 2009

The text is appearing on a new line because of the <p> tag. The paragraph tag is a block element which means it will bump to a new by default. If you place the <p> before "Background" everything will appear on one line.

Re: [jdancisin] Newbie with no clue - but want to use CMS like AutoManager

Thank you!

By zip222 - January 14, 2009

Sorry but ....

Can you let me know how to make fields invisible on the detail page if they are not filled out?

For example, if a section has 'name', 'age', 'location' fields and the age is not filled out, how do I prevent the 'age' field name (with nothing in that field) showing on the detail page?

Thanks!


this is a php thing that needs to be done within the template code. see below...

<?php if ($tablenameRecord['fieldname'] != "") { ?>
<p>Background: <?php echo $tablenameRecord['fieldname'] ?></p>
<?php }; ?>


"tablename" and "fieldname" will need to be updated to reflect your database.

Re: [jdancisin] Newbie with no clue - but want to use CMS like AutoManager

Code scares me [shocked] but I'll give it a go - thanks!

By zip222 - January 14, 2009

if you have any issues, just post your code and someone is usually able/willing to help.
Do you mean replace
Title: <?php echo $biosRecord['title'] ?><br>

with

<?php if ($tablenameRecord['fieldname'] != "") { ?>
<p>Title: <?php echo $tablenameRecord['fieldname'] ?></p>
<?php }; ?>


Whatever I did, the page showed the error "Notice: Undefined variable: tablenameRecord in /hermes/web07/b2534/as.cusanos/teamprofilesdetail.php on line 159"

By zip222 - January 14, 2009

You're close. try this instead...


<?php if ($biosRecord['title'] != "") { ?>
Title: <?php echo $biosRecord['title'] ?>
<?php }; ?>