Author Topic: wordwrap and substr  (Read 4793 times)

0 Members and 1 Guest are viewing this topic.

Offline 5images

  • Newbie
  • *
  • Posts: 17
    • View Profile
wordwrap and substr
« on: May 01, 2006, 01:57:13 AM »
I'd like to integrate two things into the display of the image_name and image_description on the detail view:

1) cutting the string and adding dots like this:
Code: [Select]
$max = 55;
if (strlen($abc) > $max)
{
$abc = substr($abc,0,52) . "...";
}

2) break long words to avoid horizontal expansion of the table (just for the case a user enters a long url):
Code: [Select]
$abc = wordwrap($abc, 45, " ", 1);


The question: Where do I have to edit the code? I can't figure out the right name for the variales (abc in the example)

Thank you in advance
Juergen


Offline Sebas Bonito

  • Sr. Member
  • ****
  • Posts: 271
  • Sebas Bonito
    • View Profile
Re: wordwrap and substr
« Reply #1 on: July 09, 2009, 02:20:07 AM »
For me the same  8O

I guess, I have to put something like this into the index.php and the categories.php to limit the title:

Quote
  if (strlen($row['image_name']) > 10)
  {
    $row['image_name'] = substr($row['image_name'], 0, 10)."...";
  }

But where?  :?: