While attempting to optimize some of my pages, I've hit an
interesting
error. The page is fairly complex, so if you need more code
than I've
provided, please let me know.
Page in question:
http://demo.mediachurch.com/news.php
(look at the "boxes"
of grouped articles at the bottom of the page, specifically
the difference
between the first article in the first box and any subsequent
articles).
Basically, this page can be constructed in (currently) two
ways, with one
column or two columns. I wish to have the code to at least
format these two
things to be the same. Therefore, I'm taking out statements
in both, and
changing them to functions I can send info from w/i the
Do...While
statements.
Here is my previous code:
//MODIFY $newsContent FOR DISPLAY
if(strlen($fpCont) > $mcNCLimit){
$newsContent = truncate_string($newsContent, $mcNCLimit);}
$newsContent = ltrim($newsContent, "<p>");
$newsContent = rtrim($newsContent, "</p>");
$newsContent =
'<p>'.$newsDate.$newsContent.' '.$newsLink.'</p>';
Which I changed to this:
function compile_article($d, $e, $f){//bring in Content, Date
& Link
$d = ltrim($d, "<p>");
$d = rtrim($d, "<p>");
$d =
'<p>'.$e.$d.' '.$f.'</p>';
return $d;
}
Here's the crazy part - it works the first time, then after
that it's
corrupted. After it spits out correct code for the first one,
it then
dispenses this garbage:
<p><span class="date">October 4 -
</span>Calvary's Annual Scott Joplin
concert was professionally recorded on CD & DVD this
year! Call the
church office to reserve a copy for yourself or a friend.
<!-- <a
href="news.php?cid=31"-->Full Story2</p>(see the
code immediately above -
it's commenting out my link!!!!!!)
Now, my variable is not re-set except in the do-while loop,
and I have all
of my variables set to unset() on every loop (to make sure
they're cleared
in case of empty recordsets in the next loop).
I have ***NO*** idea where the <!-- is coming from?
--
TIA,
Jon Parkhurst
PriivaWeb
http://priiva.net.