I have created a function for a script I am doing for my website to help with manage navigation but something inside the function is causing the PHP Engine to stop running the script. I'm not to good with match expresions so I have a feeling it will have something to do with them.
function navigation($navigation) {
if($navigation) {
preg_match("#\[coverage\](.*?)\[/coverage\]#is", $navigation, $navCov);
preg_match("#\[media\](.*?)\[/media]#is", $navigation, $navMedia);
}
if($navCov[0]) {
$coverage = explode("\n",$navCov[0]);
foreach($coverage as $link) $nav .= " <img src=\"images/arrow.gif\" alt=\"\" /> $link\n";
$return = <<<HTML
<table width="149" border="0" cellpadding="0" cellspacing="0" style="padding-top:5px;" align="center">
<tr>
<td><img height="22" width="149" src="images/coverage.jpg" alt="Coverage" /></td>
</tr>
<tr>
<td valign="top" style="background-image:url(images/table-bg.jpg);">
<table width="149" border="0" cellpadding="1" cellspacing="1">
<tr>
<td>$nav</td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding-top:0px;"><img height="20" width="149" src="images/table-bottom.jpg" alt="" /></td>
</tr>
</table>
html;
}
unset($nav);
if($navMedia[0]) {
$media = explode("\n",$navMedia[0]);
foreach($coverage as $link) $nav .= " <img src=\"images/arrow.gif\" alt=\"\" /> $link\n";
$return .= <<<HTML
<table width="149" border="0" cellpadding="0" cellspacing="0" style="padding-top:5px;" align="center">
<tr>
<td><img height="22" width="149" src="images/media.jpg" alt="Media" /></td>
</tr>
<tr>
<td valign="top" style="background-image:url(images/table-bg.jpg);">
<table width="149" border="0" cellpadding="1" cellspacing="1">
<tr>
<td>$nav</td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding-top:0px;"><img height="20" width="149" src="images/table-bottom.jpg" alt="" /></td>
</tr>
</table>
html;
}
return $return;
}
Thanx, Ragnarok