Answer the question
In order to leave comments, you need to log in
How to overwrite the NC rule for a custom Bitrix component while saving the settings?
Good afternoon friends! Please share your experience in solving the problem.
Have our own integrated CNC component.
It handles addresses like:
Answer the question
In order to leave comments, you need to log in
You have a complex component, it correctly rewrites urlrewrite. When you turn on SEF_MODE you have an extra. the SEF_URL_TEMPLATES parameter, here it will be your rules, which you want to write like this #^/somedir/([^/]+)/([^/]+)?/?(.*)$#
Save your component through a visual editor, then manually (for now) replace in the index file
"SEF_URL_TEMPLATES" => array(
"element" => "#CODE#/",
"articles" => "#CODE#/articles/",
"articles2" => "#CODE#/articles2/",
"articles3" => "#CODE#/articles3/",
),
// ...............
"SEF_MODE" => Array(
"element" => array(
"NAME" => GetMessage("T_IBLOCK_SEF_PAGE_NEWS_DETAIL"),
"DEFAULT" => "#CODE#/",
"VARIABLES" => array("CODE"),
),
"articles" => array(
"NAME" => "Страница связанных articles",
"DEFAULT" => "search/",
"VARIABLES" => array(),
),
"articles2" => array(
"NAME" => "Страница связанных articles2",
"DEFAULT" => "search/",
"VARIABLES" => array(),
),
"articles3" => array(
"NAME" => "Страница связанных articles3",
"DEFAULT" => "search/",
"VARIABLES" => array(),
),
),
// ................
в конце по вкусу можно добавить, что-то типа
if($arCurrentValues["SEF_MODE"]=="Y")
{
$arComponentParameters["PARAMETERS"]["VARIABLE_ALIASES"] = array();
$arComponentParameters["PARAMETERS"]["VARIABLE_ALIASES"]["CODE"] = array(
"NAME" => GetMessage("CP_BC_VARIABLE_ALIASES_ELEMENT_ID"),
"TEMPLATE" => "#CODE#",
);
}
$arDefaultUrlTemplates404 = array(
"news" => "",
"element" => "#CODE#/",
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question