P
P
pofeg2020-11-16 03:51:48
PHP
pofeg, 2020-11-16 03:51:48

How to make an antonym for a tag in php?

There is a tag
[isparent] текст [/isparent]
This tag displays the text contained in them if the category is a parent category and contains subcategories.
His code:

if(!isset($row['children'])) {
  $template = str_replace( "{sub-item}", "", $template );
  $template = preg_replace( "'\\[isparent\\](.+?)\\[/isparent\\]'si", "", $template );
} else {
  $template = str_replace( "[isparent]", "", $template );
  $template = str_replace( "[/isparent]", "", $template );
}


How to do the complete opposite?
[isnotparent] текст [/isnotparent]

For a tag to output content if it's not a parent?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question