Forum Moderators: coopster
<?php
// homepage FEATURED SPONSORS display
//this module displays a sponsor ad on the homepage (index) -- triggered by location_id 500 in database
require "/export/home/reference/tmn_common.php";
require "$tmn_db_inc_path/national.php";
//determine if there are any sponsorships for the current forum
$currenttime = time();
$sql = "SELECT * FROM mom_national.sponsorships WHERE (site_id='$site' AND location_id='500' AND status='active' AND ($currenttime BETWEEN startdate AND enddate))";
$resultid = mysql_query($sql, $linkid);
$headline = "<p align=\"center\"><span class=\"header\">Featured Sponsors</span></p>";
while ($resulttext = mysql_fetch_object($resultid))
{
$id = $resulttext->id;
$clickthru = "http://www.$tmn_accountname.com/mommies/modules/sponsor_clickthru.php?id=$id";
$imagename = $resulttext->imagename;
if ($headlinedisplayed) $headline=""; //only allow headline to be displayed once
$html = <<<END
<table width="100%" border="0"><tr><td valign="top">
$headline
<p align="center"><a href="$clickthru" target="_blank"><img src="http://www.themommiesnetwork.org/images/sponsorships/$imagename" border="0"></a></p>
</td></tr></table>
<img src="/mommies/images/spacer.gif" width="5" height="5"><hr width=75%>
END;
if ((mysql_affected_rows) == 0)
{
?>
<!-- TMN Adsense -->
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4730108747622378";
/* Chapter Homepage */
google_ad_slot = "5136031496";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End TMN Adsense -->
<?php
}
else
{print $html;}
}
?>
if ((mysql_affected_rows) == 0)
if (mysql_num_rows($resultid) == 0)
else
{print $html;}
}
?>
Regarding the extra bracket -- I thought that too, but it is actually the closing bracket from line 15.
if ($resulttext = mysql_fetch_object($resultid))
{
$id = $resulttext->id;
$clickthru = "http://www.$tmn_accountname.com/mommies/modules/sponsor_clickthru.php?id=$id";
$imagename = $resulttext->imagename;
if ($headlinedisplayed) $headline=""; //only allow headline to be displayed once
$html = <<<END
<table width="100%" border="0"><tr><td valign="top">
$headline
<p align="center"><a href="$clickthru" target="_blank"><img
src="http://www.themommiesnetwork.org/images/sponsorships/$imagename" border="0"></a></p>
</td></tr></table>
<img src="/mommies/images/spacer.gif" width="5" height="5"><hr width=75%>
END;
}
else {
$html = <<<END
<!-- TMN Adsense -->
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4730108747622378";
/* Chapter Homepage */
google_ad_slot = "5136031496";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- End TMN Adsense -->
END;
}
print $html;
I ended up having to take out the "<<<END ... END;" stuff
// This is my string:
$myString = <<<MYTEXTBLOCK
Some
text
goes
here
MYTEXTBLOCK;
// Note that the closing delimiter (above) is hard left, no spaces
// and nothing follows it on the line, except an optional semi-colon (;)