L
L
Lici2018-08-11 07:40:32
Smarty
Lici, 2018-08-11 07:40:32

How to trim a variable in Smarty template code?

Hello! The site code contains the following construction: I want to display the first 70 characters from it. Attempts to do through https://www.smarty.net/docsv2/ru/language.function... or so www.php.su/functions/?substr were unsuccessful. How can I do that?
<title>{$section_info.title}</title>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gerasimov, 2018-08-11
@mrTeo

In Smarty, functions are applied through a vertical bar, parameters are specified after the function name, separated by a colon:
{$section_info.title|mb_substr:0:70}

R
Roman Terekhin, 2018-08-11
@RomaZveR

mb_substr ($title, 0 , 70)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question