Hello all,
For my website I have the following code:
Now I have the following problem (ok, actually a challenge). The code above is for the "category" civil. For the military category I would like to have an other code.
As you can see, in the code above the name of the image is made out of two pieces: owner2 and owner. For the military images I only want to use the owner.
I hope someone can help me with this.
Regards,
Ruud
For my website I have the following code:
<?php
$icon = '';
if ( $MyRow->owner2 ) {
echo "<a href='#' >
<img src='../images/logo/{owner2}_{owner}.png' title='{owner2}' /></a>";
}
?>
With this code I am able to show an image if that cell is not empty. If the cell in my database is empty, no image will be shown. Now I have the following problem (ok, actually a challenge). The code above is for the "category" civil. For the military category I would like to have an other code.
As you can see, in the code above the name of the image is made out of two pieces: owner2 and owner. For the military images I only want to use the owner.
I hope someone can help me with this.
Regards,
Ruud
Hi Ruud,
PLease try something like this:
Bob
PLease try something like this:
<?php
$icon = '';
if ( $MyRow->owner2 ) {
$image = 'no_image.png';
if ( $MyRow->category == 'military' ) {
$image = $MyRow->owner.'.png';
} elseif ( $MyRow->category == 'civilian' ) {
$image = $MyRow->owner2.'_'.$MyRow->owner.'.png';
}
echo "<a href='#' >
<img src='../images/logo/{$image}' title='{owner2}' />
</a>";
}
?>
Bob
Hello Bob,
Thank you for your reply.
It worked for me, after editing your code (you just misted the = in the first $image :wink:).
But now it works! Thanks!😀
EDIT: This one works on the older version of CC. I am testing it now on my CC V4, but there it is not working😢 Any ideas?
Thank you for your reply.
It worked for me, after editing your code (you just misted the = in the first $image :wink:).
But now it works! Thanks!😀
EDIT: This one works on the older version of CC. I am testing it now on my CC V4, but there it is not working😢 Any ideas?
Hi,
This code in V3:
should be like this in V4:
Other stuff should be the same😉
Regards,
Max
This code in V3:
$MyRow->owner2
should be like this in V4:
$row['owner2']
Other stuff should be the same😉
Regards,
Max
This topic is locked and no more replies can be posted.