Jump to content

ljones

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by ljones

  1. Thanks a million guys. This works perfectly! I am not sure if there is an easier way to avoid having to put in so many echos, but I had to indent everything in order to make sure my table did not break. echo "<table width='100%'>"; echo "<tr>"; echo "<td class='room_no'>Room No.</td>"; echo "<td class='cont_info'>Contact Info</td>"; echo "</tr>"; echo "<tr>"; echo "<td> </td>"; echo "<td> </td>"; echo "</tr>"; foreach($page->children as $child) { echo "<tr>"; echo "<td class='room_no'>{$child->title}</td>"; echo "<td class='cont_info'>"; if($child->ten_pri_name) { echo "<strong>{$child->ten_pri_name}</strong><br />"; } if($child->ten_first_name) { echo "<strong>{$child->ten_first_name}"; } if($child->ten_last_name) { echo " {$child->ten_last_name}<br /></strong>"; } if($child->ten_website) { echo "<a href='{$child->ten_website}'>view website</a><br />"; } if($child->ten_email) { echo "<a href='mailto:{$child->ten_email}'>email {$child->ten_first_name}</a><br />"; } if($child->ten_phone_no) { echo "{$child->ten_phone_no}<br />"; } if($child->Media_Business) { echo "{$child->Media_Business}"; } echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td> </td>"; echo "<td> </td>"; echo "</tr>"; } echo "</table>";
  2. I am a php beginner and am having a hard time trying hide rows if fields are empty. i have a lot of blank rows that I want to not show. Also, I have long URLs and would rather have the link show as "see website" instead of echoing the website field. (it's too long for my mobile media query view). The logic I am looking for is: IF <a href='{$child->ten_website}' is empty then do not show AND do not echo >see website</a> but if it not empty echo everything. Below is the context of the code. Any help would be greatly appreciated. if($page->numChildren) { echo "<table width='100%'><tr><td class='room_no'>Room No.</td><td class='cont_info'>Contact Info</td></tr>"; echo "<tr><td> </td>"; echo "<td> </td></tr>"; echo "<tr><td class='room_no'><br />{$child->title}</td><td class='cont_info'><p>{$child->ten_pri_name}<br />"; echo "{$child->ten_first_name} {$child->ten_last_name}"; echo "<br /><a href='{$child->ten_website}'>"; echo "See website</a><br />"; echo "<a href='mailto:{$child->ten_email}'>{$child->ten_email}</a><br />"; echo "{$child->ten_phone_no}<br />{$child->Media_Business}</p></td>"; echo "</tr><tr><td> </td></tr>"; } echo "</table>"; }
×
×
  • Create New...