darryncooke
Technical User
I have a repeat region that is not displaying
before i add the repeat region i have
when i add the repeat region
the output stops after </h5> for the date. why is the trim function not working in the repeat region?
Darryn Cooke
| The New Orange County Graphic designer and Marketing and Advertising Consultant
| Marketing and Advertising blog
before i add the repeat region i have
Code:
<div class="newsBar">
<h4 class="newsSide"><a href="#" class="purple"><?php echo $row_recordNews['post_title']; ?></a></h4>
<h5 class="newsSide"><?php echo date('m/d/Y',$row_recordNews['post_date']); ?></h5>
<?
echo trim_text($row_recordNews['post_content'], 120);
function trim_text($input, $length, $ellipses = true, $strip_html = false) {
//strip tags, if desired
if ($strip_html) {
$input = strip_tags($input);
}
//no need to trim, already shorter than trim length
if (strlen($input) <= $length) {
return $input;
}
//find last space within length
$last_space = strrpos(substr($input, 0, $length), ' ');
$trimmed_text = substr($input, 0, $last_space);
//add ellipses (...)
if ($ellipses) {
$trimmed_text .= '...';
}
return $trimmed_text;
}
?><a href="#" class="purple">Continue</a></div>
when i add the repeat region
Code:
<?php do { ?>
<div class="newsBar">
<h4 class="newsSide"><a href="#" class="purple"><?php echo $row_recordNews['post_title']; ?></a></h4>
<h5 class="newsSide"><?php echo date('m/d/Y',$row_recordNews['post_date']); ?></h5>
<?
echo trim_text($row_recordNews['post_content'], 120);
function trim_text($input, $length, $ellipses = true, $strip_html = false) {
//strip tags, if desired
if ($strip_html) {
$input = strip_tags($input);
}
//no need to trim, already shorter than trim length
if (strlen($input) <= $length) {
return $input;
}
//find last space within length
$last_space = strrpos(substr($input, 0, $length), ' ');
$trimmed_text = substr($input, 0, $last_space);
//add ellipses (...)
if ($ellipses) {
$trimmed_text .= '...';
}
return $trimmed_text;
}
?>
<a href="#" class="purple">Continue</a></div>
<?php } while ($row_recordNews = mysql_fetch_assoc($recordNews)); ?>
the output stops after </h5> for the date. why is the trim function not working in the repeat region?
Darryn Cooke
| The New Orange County Graphic designer and Marketing and Advertising Consultant
| Marketing and Advertising blog