Forums

Only show icon when cell is filled

flyboeing 07 Jun, 2011
Hello all,

I have several questions about the Chronoconnectivity for Joomla 1.5 (yes, i am still running that version😛 ).

In the CC I made my page to show the information stored in my database. In my MYSQL database I have a column with the URL of a photo. In my form on my website I have this column for the photo URL. Now I only want to have an icon (of a camera) if there is an URL for that record. If the record in the database has no URL of a photo, no icon is visible.

How can I make that?

Kind regards,
Ruud
GreyHead 07 Jun, 2011
Hi Ruud,

You're OK, there is no new version of ChronoConnectivity.

You can do that with some PHP in the Body box
<?php
$icon = '';
if ( $MyRow->photo_url ) {
  $icon = "<img src='path/to/icon.jpg' alt='' />";
}
?>
. . .
<php echo $icon; ?>
. . .

Bob
flyboeing 08 Jun, 2011
Thank you Bob for your reply.

I tried this but I can't get it to work. Maybe I am doing something wrong here.
<td>

<?php
$icon = '';
if ( $MyRow['ac'] ) {
  $icon = "<img src='./images/AC.png' alt='AC' />";
}
?>

<?php echo $icon; ?>

</td>

I pasted this code into the body section of the CC form, and changed the parameters. After that I went to my website to check the result, but no succes😟

Did I made some kind of mistake?
GreyHead 08 Jun, 2011
Hi flyboeing ,

Looks OK to me assuming that the resulting path is OK. What do you see in the page source?

By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
flyboeing 08 Jun, 2011
Hi bob,

Before I made this in CC, I had the entire table in a php file.
echo ' <td width="" class="style9" id="border_b" bgcolor="'.$kleur.'">';
if (!empty($aRow['ac']))
  {
echo " <a href='#' ><img src='images/AC.png' title='<u><i>Aviation Cosmetics:</i></u><br />".$aRow['ac']."' border=0></img></a>";
}'</td>';

This is the php-code that I used in my php file. Maybe there is a way to put this into CC?
GreyHead 08 Jun, 2011
Hi Ruud,

Fixed, My apologies, I had the syntax wrong it's $MyRow->photo_url not $MyRow['photo_url']

Bob

PS I have corrected my earlier post.
flyboeing 08 Jun, 2011
Hello Bob,

Thank you for your help.
Now it works!
This topic is locked and no more replies can be posted.