El Director
New member
The database is updated through a webform using php. If a url is not entered for the title, then the link becomes the webroot, which is the index page, thus causing a refresh is clicked. How can I edit the code to only have the a tag apply if the url field is not empty.
-----
<div id="tabsContainer" style="height:100%">
<ul id="tabs">
<li><a href="#studentsHighlights">Students</a></li>
<li><a href="#employersHighlights">Employers</a></li>
<li><a href="#alumniHighlights">Alumni</a></li>
</ul>
<?php
foreach ($arrHighlights as $category => $theAnnouncements) {
?>
<ul class="highlightsList" id="<?= strtolower($category) ?>Highlights">
<?php
//output the highlights
foreach ($theAnnouncements as $row) { ?>
<li><big><a href="<?= WEB_ROOT.'/'.$row['url'] ?>"><?= $row['announcement_title'] ?></a></big>
<?php
if (!empty($row['event_start_time'])) {//if an event start dates/time exist for this announcement
echo "<small>";
$eventStartTime = strtotime($row['event_start_time']);
$eventStopTime = strtotime($row['event_stop_time']);
//display the date and time range for the event, or the date range for multiday events
$eventStartDate = date('F j, Y', $eventStartTime);
$eventEndDate = date('F j, Y', $eventStopTime);
echo $eventStartDate;
if ($eventStartDate != $eventEndDate) {//multiday event
echo " - ".$eventEndDate;
}
else { //show the time range
echo " ".date('g:iA', $eventStartTime)." - ".date('g:iA', $eventStopTime);
}
echo "</small>";
}
?>
<?= $row['description'] ?>
</li>
<?php
}
?>
</ul>
<?php
} ?>
</div>
-----
<div id="tabsContainer" style="height:100%">
<ul id="tabs">
<li><a href="#studentsHighlights">Students</a></li>
<li><a href="#employersHighlights">Employers</a></li>
<li><a href="#alumniHighlights">Alumni</a></li>
</ul>
<?php
foreach ($arrHighlights as $category => $theAnnouncements) {
?>
<ul class="highlightsList" id="<?= strtolower($category) ?>Highlights">
<?php
//output the highlights
foreach ($theAnnouncements as $row) { ?>
<li><big><a href="<?= WEB_ROOT.'/'.$row['url'] ?>"><?= $row['announcement_title'] ?></a></big>
<?php
if (!empty($row['event_start_time'])) {//if an event start dates/time exist for this announcement
echo "<small>";
$eventStartTime = strtotime($row['event_start_time']);
$eventStopTime = strtotime($row['event_stop_time']);
//display the date and time range for the event, or the date range for multiday events
$eventStartDate = date('F j, Y', $eventStartTime);
$eventEndDate = date('F j, Y', $eventStopTime);
echo $eventStartDate;
if ($eventStartDate != $eventEndDate) {//multiday event
echo " - ".$eventEndDate;
}
else { //show the time range
echo " ".date('g:iA', $eventStartTime)." - ".date('g:iA', $eventStopTime);
}
echo "</small>";
}
?>
<?= $row['description'] ?>
</li>
<?php
}
?>
</ul>
<?php
} ?>
</div>