I have stories and images displayed on a web page through a "repeat region" mostly designed with DV. I'm getting the data & image path from MySql.
The image with the story is a link (to larger image) and is "thumbnail" size, reduced from the full size using a style. (imgright1)
Everything works great except if there is no image with a story. Say I set the thumbnail size to 200px wide. it offsets all stories with no images 200px (no surprise)
What I want to do is write an "if" statement, that says something along the line, if the "ImagePath" is null then "class=" null. Of course then "class" needs to be a variable and I can't seem the get that code correct either.
Any ideas?


My style

.imgright1{
	float: right;
	padding-left: 5px;
	padding-bottom: 5px;
	padding-top: 5px;
	width: 200px;
}

Repeat Region

<?php do { ?>
              <p class="style23"><?php echo $row_rsFrontPage['Headline']; ?>            </p>
              
              <a href="<?php echo $row_rsFrontPage['ImagePath']; ?>" rel="lightbox[]" title="<?php echo $row_rsFrontPage['ImageCaption']; ?>"><img style="margin:0px 0px 5px 3px;  " 
              src="<?php echo $row_rsFrontPage ['ImagePath']; ?>"alt=""  border="0" class="imgright1"/> </a> 
               
              <p align="justify" class="style17"><?php echo $row_rsFrontPage['Story']; ?></p>
              <p align="right" class="style16">-<?php echo $row_rsFrontPage['Sig']; ?></p>
              <?php } while ($row_rsFrontPage = mysql_fetch_assoc($rsFrontPage)); ?></form>

Thank You!

Simple. You do it this way.

<?php
.....
if($row_rsFrontPage['ImagePath']=="") { 
  $class="noclass";
} else { 
   $class="applyclass"; 
}
?>
<p class="<?php echo $class; ?>">blah blah blah... </p>

Hope that helps.
Naveen

Naveen
Thank You very much!!
Mark

You are welcome! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.