S
S
Sakit Aliyev2017-06-16 15:14:22
CMS
Sakit Aliyev, 2017-06-16 15:14:22

How to extract specific information from a database field?

<?php echo $field['handler']->setItem($item)->parseTeaser($item[$field['name']]);?>

This piece of code displays a link immediately in the 'a' tag How to extract from the field what exactly is url_key in the picture without the 'a' tag. I did not find the documentation, why is this problematic for instantcms. Naturally, not only one record is displayed, but several, which have different paths and line lengths.
<a href="/files/download/11/e0ab03d8">Скачать</a>
cbad8e44c9bc462aa8e46f6e7531f2cd.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ipokos, 2017-06-17
@sakitaliev

Perhaps the MySQL gurus will be able to give you a solution with a query...
But here's a solution with PHP:

$text = '<a href="/files/download/11/e0ab03d8">Скачать</a>';
preg_replace("'<[\/\!]*?[^<>]*?>'si", null, $text);
echo $text; // вернет Скачать

Regular expression clears string from html tags

S
Sakit Aliev, 2017-10-23
@sakitaliev

Guys this is YAML

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question