S
S
Sergey Chazov2019-07-12 00:24:13
1C-Bitrix
Sergey Chazov, 2019-07-12 00:24:13

Why is the variable not being restored from the template?

I am writing the first complex component in my life
And in this place:

//шаблоны запросов
$arDefaultUrlTemplates404 = array(
    "list" => "/LinuxSoftComplex/",
    "detail" => "#ELEMENT_ID#/",
);

$arComponentVariables = array(
    "ELEMENT_ID",
    "ELEMENT_CODE",
);

$arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams["SEF_URL_TEMPLATES"]);

$arVariables = array();
$componentPage = CComponentEngine::ParseComponentPath(
    $arParams["SEF_FOLDER"],
    $arUrlTemplates,
    $arVariables
);

I $arVariablesalways get an empty one (and should, as I understand it, give an array of restored values). i.e. I click on the view link мой-сайт/LinuxSoftComplex/360/ and expect to get in $arVariables360, but it's empty. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Emelyanov, 2019-07-13
@babarun

/LinuxSoftComplex/ - should be in $arParams["SEF_FOLDER"], but in an array

$arDefaultUrlTemplates404 = array(
    "list" => "/LinuxSoftComplex/",
    "detail" => "#ELEMENT_ID#/",
);

the list attribute must be empty:
$arDefaultUrlTemplates404 = array(
    "list" => "",
    "detail" => "#ELEMENT_ID#/",
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question