Counting String and adding '...' if String is greater than $
Posted: Thu Jan 29, 2009 12:56 pm
Hi everyone! Nice to meet you.
I'm having some trouble figuring out how to do this.
I'm creating a variable called $review from my database. I am using the substr function (function, right?) to not pull more characters than 1417. If the variable equals exactly 1417 characters, I want to create a variable called $more which is equal to "...". The variable called more will be echoed after the $review variable to signify that there is still more review. This will tell the user to click on the link to see the full page and read the whole review.
Unfortunately, it sounded easy... but I can't figure out how to make that work! I've tried using the 'count' function and the 'strlen' function to count the characters and if it is equal to 1417 to create the variable 'more'. I haven't been able to make this work, though.
Any help would be greatly appreciated! Thanks so much~
The website that I want to do this to can be found here: http://zehnaart.com/imp It is the index page that I am doing this to. The "Hot Topic" movie is the review that I am looking to do this to.
I'm having some trouble figuring out how to do this.
I'm creating a variable called $review from my database. I am using the substr function (function, right?) to not pull more characters than 1417. If the variable equals exactly 1417 characters, I want to create a variable called $more which is equal to "...". The variable called more will be echoed after the $review variable to signify that there is still more review. This will tell the user to click on the link to see the full page and read the whole review.
Unfortunately, it sounded easy... but I can't figure out how to make that work! I've tried using the 'count' function and the 'strlen' function to count the characters and if it is equal to 1417 to create the variable 'more'. I haven't been able to make this work, though.
Any help would be greatly appreciated! Thanks so much~
The website that I want to do this to can be found here: http://zehnaart.com/imp It is the index page that I am doing this to. The "Hot Topic" movie is the review that I am looking to do this to.