Answer the question
In order to leave comments, you need to log in
Seems like a commonplace problem with substr and mb_substr?
There is a site on Joomla, in one module you need to limit the output of the header
. This code inserts diamonds with questions, they say you need to use mb_substr:
if (strlen($item->title) > 70) {
$item->title = substr($item->title, 0, 70);
}
$item->title = mb_substr($item->title, 0, 70);
strlen($item->title)
mb_internal_encoding("UTF-8");
Answer the question
In order to leave comments, you need to log in
mb_substr needs to be told which encoding to cut.
and also use not strlen, but mb_strlen and also specifying the encoding
This is a template engine, of which there are a great many. For example, in FatFree it will look like in {{ @имя_переменной }}
Multilingual style, then it is very easy to add something in style {{ @current_lang['Phrase_A'] }}
or {{ @langGet('Phrase_A') }}
As I said there are a lot of templating engines, find the one that you like best.
Perhaps it means outputting a string through echo.
If a string is displayed in double quotes, then variables can be used inside, for example
If the interpreter encounters a $ sign, it captures as many characters as possible to form a valid variable name. If you want to specify the end of a name, enclose the variable name in curly braces.
echo "пример {$str}s"; //будет использована переменная $str
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question