The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Trimming Row output for display
Hi,
I've got a query and string to display some information and usernames. One problem I'm having is long usernames. I'd like to truncate usernames longer than 8 characters to 6 characters then add ... after it. I can't seem to get this working in my while loop. Any help would be appreciated. here's what I've got right now inside the while loop Code:
if (strlen($row2->strUsrid) > 8) { $Winner = substr($row2->strusrid, 0, 8 - 2) . '..'; } |
#2
|
||||
|
||||
why are you doing 8-2 and not just 6?
|
#3
|
|||
|
|||
well 6 wasn't working.
|
#4
|
|||
|
|||
is Usrid the variable you want to be trimming? It would seem intuitive to be trimming a variable called Username (or whatever you store it in).
Unless of course you have the username stored in that variable. |
#5
|
|||
|
|||
Use this:
PHP Code:
|
#6
|
|||
|
|||
Thanks Brad.loo. That worked perfectly with the substituted string I needed to trim.
(and yes it was strusrid it's a custom table not native to vb3.) |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|