Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Elxis documentation
for users and developers.
Home
Help
Login
Register
Elxis CMS Forum
»
Extensions
»
Components
»
Characters limit show
« previous
next »
Print
Pages: [
1
]
Author
Topic: Characters limit show (Read 3786 times)
herve34000
Newbie
Posts: 47
Characters limit show
«
on:
September 12, 2011, 07:44:35 »
Hi,
I have just a question about weblink components. We would like to show a characters limit. It's possible ? if, what we can do to add the code and where.
Thank you very much for you help.
Sample
http://www.mediacollege.com/internet/javascript/form/limit-characters.html
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: Characters limit show
«
Reply #1 on:
September 16, 2011, 20:25:43 »
In PHP for UTF-8 encoded strings using Elxis eUTF class:
<?php
$word = 'This is a really looooooooooong string';
echo (eUTF::utf8_strlen($word) > 20) ? eUTF::utf8_substr($word, 0, 17).'...' : $word;
?>
For Latin encoded strings you can use the standard php functions (faster)
<?php
echo (strlen($word) > 20) ? substr($word, 0, 17).'...' : $word;
?>
«
Last Edit: September 16, 2011, 20:28:27 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Extensions
»
Components
»
Characters limit show