Truncate Nextgen description
-
Aaack. I can’t seem to figure out what I’m doing wrong. I’m trying to truncate my Nextgen gallery image descriptions and I’ve managed to truncate them, but it breaks the rest of my page. Is there anyone who could look at this piece of my code and tell me what the heck I’m doing wrong? Thanks in advance.
<?php foreach ( $images as $image ) : ?> ...stuff... <?php function truncate($string, $del) { $len = strlen($string); if ($len > $del) { $new = substr($string,0,$del)."..."; return $new; } else return $string; } $arg = "$image->description"; ?> <p><?php echo truncate($arg, 130)."n"; ?></p> ...more stuff.... <?php endforeach; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Truncate Nextgen description’ is closed to new replies.