The task is this - in the ocstore you need to make sure that the section header is h1 if the section description is empty, but if the section description is filled, then h2

Closed due to the fact that the essence of the question is not clear to the participants of rjhdby , Kromster , andreymal , aleksandr barakin , br3t July 7 '17 at 8:39 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    Suppose your description is in a certain variable:

     $des = "Здесь описание"; // некая переменная которой передается описание if(strlen($des)==0){ // проверяем длину строки, если ноль то описание отсутствует и выводим просто заголовок echo "<h1>Заголовок</h1>"; } else { // в противном случае, если есть описание то выводим заголовок и описание echo "<h2>Заголовок</h2>"; echo "<p>Описание</p>"; } 
    • The topic starter asked about opencards, and the answer about how to write if and check the length of the string. The main part of the question (wangooi) about how to tighten the description of the section. Add, if you know. - AK