E
E
Elvin_Fich2020-09-24 15:31:57
Telegram
Elvin_Fich, 2020-09-24 15:31:57

Styles do not work when displaying a message in telegram?

In the .php file, when specifying styles, they are not applied when messages arrive in the cart, but the none_propisano and voz_kli styles, where could there be an error or how would it be correct?

if(isset($propisano_chelovek_nedvijka)){
echo "  <style type='text/css' media='all'>
            none_propisano {
                display:none;
            }
        </style>";
};
if(!empty($vozrast_okno_forma_avto)){
echo "  <style type='text/css' media='all'>
            voz_kli {
                color:red;
            }
        </style>";
};
        


    $message = "<b>Пришла заявка с сайта Finansi (<b>ПЕРСОНАЛЬНЫЙ ПОДБОР КРЕДИТОВ</b>)\n</b>"."<b>Вид кредита:</b> $vid_kredita\n"."<b>Имя заказчика:</b> $name\n"."<b class='voz_kli'>Возраст клиента:</b> $vozrast_okno_forma_avto\n"."<b>Пол:</b> $pol_okno_forma_avto\n"."<b>Дата получения кредита:</b> $data_polycheniya_kredita\n"."<b>Сумма кредита:</b> $summa_kredita $valuta3\n"."<b>Срок кредита:</b> $srok_zaima_avto $srok2\n"."<b>Ежемесячный доход:</b> $egemesyachiy_dohod $valuta2\n"."<b>Стаж работы на последнем месте:</b> $stag_raboti\n"."<b>E-mail почта:</b> $email_okno_forma_avto\n"."<b>Брал ли кредиты за последние 5 лет:</b> $kedit_za_5_let\n"."<b>Сумма ежемесячных обязательств кредита за последние 5 лет:</b> $summa_egemesyachnih_obyazatelstv\n"."<b>Регистрация в РБ:</b> $registraciya_v_rb\n"."<b>Какое образование:</b> $obrazovanie_okno_forma\n"."<b>Привлекались ли к уголовной ответственности:</b> $ygolovka_okno_forma\n"."<b>Водительские права:</b> $prava_na_avto_okno_forma\n"."<b>Наличие авто:</b> $nalichie_avto\n"."<b>Тип двигателя:</b> $type_dvijka\n"."<b>КПП:</b> $korobka_peredach\n"."<b>Наличие недвижимости:</b> $nedvijka\n"."<b>Город где находиться недвижимость:</b> $gorod_nedvijki\n"."<b>Количество комнат в квартире:</b> $kolichestvo_komnat_nedvijki\n"."<b style='display:none'>Сколько человек прописано в квартире:</b> $propisano_chelovek_nedvijka\n"."<b>Прописаны ли несовершеннолетние:</b> $deti_propisani\n"."<b>Телефон:</b> $phone\n"."<b>Клиент из города:</b> $city\n"."<b>Название автомобиля:</b> $mark\n"."<b>Год выпуска:</b> $year\n"."<b>Объём двигателя:</b> $objem\n"."<b>Тип двигателя:</b> $type\n"."<b>КПП:</b> $corobka\n"."<b class='none_propisano'>тест:</b> $propisano_chelovek_nedvijka\n";

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tempick, 2020-09-24
@tempick

1) You display the styles in the browser, and the message is sent to the telegram. How does he learn about these styles?
2) Telegram does not support css at all. Here is the dock https://core.telegram.org/bots/api#formatting-options


The Bot API supports basic formatting for messages. You can use bold, italic, underlined and strikethrough text, as well as inline links and pre-formatted code in your bots' messages. Telegram clients will render them accordingly. You can use either markdown-style or HTML-style formatting.

A
ambal245, 2020-09-24
@ambal245

In order to send the input data, you need to collect them initially in the executable file when sending. Check each field for empty space. If we have a value, then we add it to the line of the message being sent.
About css. Telegam only accepts <b>, <i>(bold and italic) and the <a href="">. Which can be passed in two ways htmland markdown. The generation of such data depends on the selected option. When sending a message, you need to tell the Tg server how to format the value in the parameter &parse_mode.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question