Hi everyone,
I have a section of code that I’m looking to reduce to it’s most simplistic levels. Essentially what this code is: instructing the page to write is
[ul][li]1) if there are photos display them, [/li]
[li]2) parse them from $property_image_urls to $images via explode, [/li]
[li]3) then display/arrange them based on user preference. [/li][/ul]
Here is the code:
[php]/*
-
Display the listing photos based on user preference. If user prefer large photos, we just display
-
a single column of big photos, otherwise display 2 columns of smaller photos.
*/
if ($property_image_urls != “”) {$images = explode("|", $property_image_urls);
$imageCounter = 0;
$display .= "
Additional Photos
";if (empty($user_image_preference)) {
while($imageCounter < count($images)) { $display .= " <tr> <td width='400' align='center'><img src='" . $images[$imageCounter] . "' width='400' alt='' /></td>"; $imageCounter++; if(isset($images[$imageCounter])) { $display .= " <td width='305' align='center'><img src='" . $images[$imageCounter] . "' width='400' alt='' /></td>"; $imageCounter++; } else { $display .= " <td width='305' align='center'></td>"; } $display .= " </tr> <tr><td colspan='2' align='left' height='25'></td></tr>"; }
}
else if ($agent->settings->adPhotoPreference == “L”) {
foreach($images as $img) {
$display .= "
";
}
}
$display .= "
All I would like the code to do is parse the $property_image_urls into the $images as is above, remove all the PHP about user preferences and all that, AND get rid of all HTML elements there without interfering with the php code (preferably keeping the images something like 300 height 400 width when written as $images); essentially just reducing it to it’s basic level which is just show the images.
I realize this is probably pretty simple but no matter how I edit the code it ends up not being able to render and I have to get this thing wrapped up. If someone can help me I’ll gladly shoot you $10 bucks so you can buy yourself a coffee!