D
D
Dmitry Mityaev2018-03-09 00:06:02
1C-Bitrix
Dmitry Mityaev, 2018-03-09 00:06:02

Bitrix: exam 1. How to implement different display of information in the header depending on the time?

People! Please help me solve the problem! The whole difficulty is that BITRIX insists that it be solved
using the API of Bitrix itself... I re-read the API documentation, but did not find any suitable function...
"Implement different display of information in the header. )
working (from 9 to 18), then the phone is displayed, if not working, then email"
5aa1a55f7b2c8417771935.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Nikolaev, 2018-03-09
@DMityaev

As a person who passed this exam and has been working with 1C-Bitrix for more than 5 years, I do not know about the function that determines working time.
As I would read the requirements for this task: it is necessary to determine whether the working time on the server is now using php and Bitrix tools, connect the displayed area with a phone number or email (2 included areas).
In my opinion, it means that you need to connect this layout not through include / require, but through a component / built-in connection function. This is exactly what is being tested.

D
Dmitry Mityaev, 2018-03-21
@DMityaev

Thank you. I did it through the functions of PHP itself, everything turned out to be simple:

<div class="phone"

<?
$Now = date(H);
$WorkDayStart = 9;
$WorkDayEnd = 18;
If ($WorkDayStart < $Now and $Now < $WorkDayEnd): ?>


<?$APPLICATION->IncludeComponent(
"bitrix:main.include",
"",
Array(
"COMPONENT_TEMPLATE" => ".default",
"AREA_FILE_SHOW" => "file",
"AREA_FILE_SUFFIX" => "inc",
"EDIT_TEMPLATE" => "",
"PATH" => "/include/telefon.php"
)
);?> 

<?else:?>

<?$APPLICATION->IncludeComponent(
"bitrix:main.include",
"",
Array(
"COMPONENT_TEMPLATE" => ".default",
"AREA_FILE_SHOW" => "file",
"AREA_FILE_SUFFIX" => "inc",
"EDIT_TEMPLATE" => "",
"PATH" => "/include/email.php"
)
);?>

<?endif?>
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question