if album exists print command?

There's a good chance that my title didn't make sense and that's partially why I'm posting in the first place, cause I'm not exactly sure how to search for the solution to my problem and subsequently unsure of how to ask about a solution.

Basically, I have a series of albums. Some have very lengthy descriptions. I have a div block that contains my description, which I'd like only to appear if a description exists. As it is, the div block shows up on all album pages, most with empty descriptions.

So I guess my question is, how would I go about telling the album.php page to only print the div if the album description exists?

Comments

  • acrylian Administrator, Developer
    Use`if(!empty(getAlbumDesc()) { printAlbumDesc() }` where your description should appear
  • I wasn't able to get that code to work. It kept giving me this error:

    Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or '$'

    Basically, I want this set of code:

    `

    Album Explanation



    <?php printAlbumDesc(true); ?>

    `

    to execute only if a description exists. Would the code you gave me pull that off?
  • `<?php<br />
    $desc = getAlbumDesc();

    if (!empty($desc)) {

    ?>

    Album Explanation



    <?php printAlbumDesc(true); ?>



    <?php } ?>`
  • That worked perfect! Thank you so much! :)
Sign In or Register to comment.