E
E
exedis2018-03-12 11:26:45
1C-Bitrix
exedis, 2018-03-12 11:26:45

How to check if ShowMeta('') is empty in Bitrix?

Hello, you need to check if the description meta tag is empty

$APPLICATION->ShowMeta('description');

The usual methods like
if (!empty ($APPLICATION->ShowMeta('description')) )
does not work. How to check for emptiness? Or is it possible in some other way to set the default description to one, and if the field is filled in, then display it accordingly from the field?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikolaev, 2018-03-12
@gromdron

To begin with, understand that at the moment of calling ShowMeta you have no data that they are filled. That is, it is NOT GOOD to check for emptiness there!
Check out the following documentation:
1) Delayed Function Mechanism
2) Page Execution Order
After reading it, you will understand that it will not work exactly the way you want. BUT!
You can write your own deferred function with its own behavior and get the desired result.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question