zenphoto forums » Usage Support

Print description only if there's one

(4 posts)

Tags:

  1. Barbara

    Contributor
    Joined: Feb '07
    Posts: 137

    How can you set zp to print the album description only if it's present?
    This is as far as I can go:
    <?php if ( $AlbumDesc ) { ?><p><?php printAlbumDesc(); ?></p><?php } ?>

    It's because I want to get rid of the empty spans in the markup when an album doesn't have a description.
    <span class="zp_uneditable zp_uneditable_album_desc"></span>

    Posted 2 years ago #
  2. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,341

    Those empty spans are needed for the inline editing on the website (you can click there and add text directly.
    Use printAlbumDesc(false,'',false)

    Always a good idea to look at the docs:
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintAlbumDesc

    Of course something like if(getAlbumDesc() != "") { echo getAlbumDesc(); } would work, too.

    Don't forget to read the Forum rules and usage resources
    Posted 2 years ago #
  3. micheall

    Contributor
    Joined: Aug '09
    Posts: 513

    @barbara
    I used the example acrylian did on my last theme. I only used it deciding if I needed to add captioning to a lightbox though. As acrylian said, if you don't have it on your image page you won't be able to edit it from there while logged in as admin. Remember that your gallery views are different when you're logged in than when a normal users views your site.

    Posted 2 years ago #
  4. Barbara

    Contributor
    Joined: Feb '07
    Posts: 137

    Thanks acrylian! I put
    <?php if (getAlbumDesc() != "") { ?><p class="description"><?php printAlbumDesc(); ?></p><?php } ?> and did the same for the date. Everything is perfect now. :)

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in to post.