• oldmankit

    (@oldmankit)


    Hello,

    I don’t really know php, I just work with what I can from others, copying and pasting and slowly understanding things. I have got this far with a link:

    <a href="<?php echo $image->imageURL ?>" title="<h7><?php echo $image->alttext ?></h7><h8>&nbsp;&nbsp;|&nbsp;&nbsp;<?php echo $image->description ?></h8>" <?php echo $image->thumbcode ?> >
    				<?php if ( !$image->hidden ) { ?>
    				<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
    				<?php } ?>
    			</a>

    (The reason I have h7 etc. inside a title is that the title is used by a script – shutter. It’s for making a photo gallery.)

    It’s doing everything nicely, unless $image->description is empty. Then I get alttext followed by |. If the description is empty, I don’t want the | to display.

    I guess this is pretty easy to do, if you know php? Something to do with ‘if’?

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    (@esmi)

    There’s no such tag as H7 in HTML.

    Thread Starter oldmankit

    (@oldmankit)

    There’s no such tag as H7 in HTML.

    Erm, really? Ok, well I’ll change them to h5 and h6. Actually, the code didn’t validate, so I changed the ‘<‘ etc. to the html code. It validates fine now.

    I’d still like help making the little php ‘if’ bit. I only want [code]??|??<?php echo $image->description ?>[/code]
    if $image->description is not empty.

    Thread Starter oldmankit

    (@oldmankit)

    Will this be difficult? To reiterate:

    If the the description field is empty, I want to echo nothing. If it is not empty, I want to echo something. How do I do that with php?

    Thanks to anyone that can help me here… ??

    esmi

    (@esmi)

    <?php if ( $image->hidden ) :?>
    <a href="<?php echo $image->imageURL; ?>" title="<?php echo $image->alttext; ?> <?php echo $image->descriptio;n ?>" <?php echo $image->thumbcode; ?> ><img title="<?php echo $image->alttext; ?>" alt="<?php echo $image->alttext; ?>" src="<?php echo $image->thumbnailURL; ?>" <?php echo $image->size; ?> /></a>
    <?php endif;?>
    Thread Starter oldmankit

    (@oldmankit)

    Thank you for posting. Forgive me if I have misunderstood.
    You’ve started with $image->hidden, but I’m not using any hidden images. Hidden images are part of NextGen gallery, for images you don’t want to be displayed, I believe.

    I will try to explain better.

    Sometimes <?php echo $image->description ?> gives me nothing; there is no description for the photograph. If there is no description, I want:
    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>" <?php echo $image->thumbcode ?> >

    But if there IS a description, I want:
    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>&nbsp;&nbsp;|&nbsp;&nbsp;<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

    esmi

    (@esmi)

    <?php if( $image->description ) :?><a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>&nbsp;&nbsp;|&nbsp;&nbsp;<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
    <?php else :?> <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->alttext ?>" <?php echo $image->thumbcode ?> >
    <?php endif;?>
    Thread Starter oldmankit

    (@oldmankit)

    Sorry for the delay in testing this.

    I’ve copied and pasted as is, and unfortunately it is still inserting the ‘|’, even when there is no description.

    Basically, it is always using the first line, and never what follows <?php else :?>.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Help with php’ is closed to new replies.