Forums

Characters Limit

alex305v 05 May, 2015
On my "Front Page" I would like to add a character limit of 50 to (Notes.message:Notations) in CCv5. Once they click on a link it will take the user to the full text. Can anyone plz help.

Alex
GreyHead 05 May, 2015
Hi alex,

I think that you can use the MySQL SUBSTR() method in a custom column. Otherwise you could always crop the string with PHP in a PHP column.

Bob
alex305v 05 May, 2015
Bob,

I am not too familiar with how that goes, would you help me with the PHP code?

Thanks
GreyHead 08 May, 2015
Hi Alex,

The PHP would be something like
<?php $row->xxx = substr($row->xxx, 0, 50); ?>
or maybe that needs to be $row['xxx'] in this version ???

Bob
alex305v 11 May, 2015
I tried under PHP field
Notes.message:<?php $row['message'] = substr($row['message'], 0, 50); ?>

and
<?php $row['message'] = substr($row['message'], 0, 50); ?>


then I tried under Field
Notes.message:<?php $row['message'] = substr($row['message'], 0, 50); ?>


also with $row->xxx

and nothing. Am I missing here something?
GreyHead 11 May, 2015
Hi Alex,

What's the actual name of the data entry you want to trim - your first post said Notes.message:Notations ?

Bob
GreyHead 12 May, 2015
Hi alex305v,

I doubt that is the name as the : would cause problems. Whatever it is the PHP needs to use the same name in place of message

Bob
angelmorales 20 Jul, 2015
Hello i have the same issue, the field that i want to display with character limit its named:
Consulta_Incidencias_Plexus_Azucena.Descripcion_error:Descripcion error
Where do I have tu put the code ?
I try in the option:Front List-Settings-PHP Funcions but it doesnt work
Could you help me ??

Thanks
angelmorales 20 Jul, 2015
I try with the following codes, but wich one its the winner and how can I adapt to the field: Consulta_Incidencias_Plexus_Azucena.Descripcion_error:Descripcion error ???

I tried under PHP field

Notes.message:<?php $row['message'] = substr($row['message'], 0, 50); ?>
and

<?php $row['message'] = substr($row['message'], 0, 50); ?>
then I tried under Field

Notes.message:<?php $row['message'] = substr($row['message'], 0, 50); ?>

GreyHead 21 Jul, 2015
1 Likes
Hi angelmorales,

Please try this in the PHP Functions box
fieldNotes.message:return substr($cell, 0, 50); 


Bob
This topic is locked and no more replies can be posted.