J
J
jecer_inside2022-02-27 12:37:23
PHP
jecer_inside, 2022-02-27 12:37:23

How to add a new line if there is a certain phrase in h1?

There is an online store with the Smarty template engine
in more than 1.5k products there are phrases, in h1, "to order", "for painting" and "leather-covered"

how to add a line to these products, under h1, "manufactured within.. ."?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2022-02-27
@jecer_inside

unload products that have the search phrases in their descriptions

SELECT id, description FROM products WHERE description LIKE '%под заказ%' OR description LIKE '%под покраску%' OR ...

cycle through the selected products and change the values ​​of the description field
$row['description'] = str_replace('</h1>', "</h1>\n<h3><!-- craft time -->изготавливается в течении $craftTime</h3>", $row['description']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question