Answer the question
In order to leave comments, you need to log in
How to get a substring in php or smarty?
How from this line
"<div><p><img src="http://kolhoz1.mosco-web.ru/wa-data/public/blog/img/blog-image-4.png"></p><p>Какой-то текст</p></div>"
"<img src="http://kolhoz1.mosco-web.ru/wa-data/public/blog/img/blog-image-4.png">"
Answer the question
In order to leave comments, you need to log in
1 step. Get the part you want with regexp.
$re = '/(<img\ssrc=".*">)/';
$str = '<div><p><img src="http://kolhoz1.mosco-web.ru/wa-data/public/blog/img/blog-image-4.png"></p><p>Какой-то текст</p></div>';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Smarty->assign(...)->display(...);
{php}
{/php}
, и в этих же тегах {php}Smarty->assign(...);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question