Answer the question
In order to leave comments, you need to log in
How to pass Bitrix catalog partition ID to javascript?
Good afternoon, dear Bitrix and PHP experts.
There was a problem:
It is required in the directory partition template to determine the value of the ID of the current directory partition.
After passing this value to javascript.
Script text:
<script type="text/javascript">
window.ad_category = ""; <<--- Передать необходимо в эту переменную
Answer the question
In order to leave comments, you need to log in
In general, in the screenshot, the validator swears specifically at the P tag, which would be true in html4, but in html5 (and this doctype is set on your site), you can nest block elements in A tags:
https://www.w3.org/TR /html-markup/a.html#a-changes
Perhaps you need to manually select the desired doctype in the validator (select html5) and the error should disappear.
It says what it means - https://translate.google.com/
The p element cannot be placed inside the a element , block elements cannot be placed inside inline elements, just the opposite (inline elements can be placed inside block elements)
p
cannot be placed in h1
Error can be fixed by changing p
to span
or
You have an HTML5 doctype, you can wrap blocks with a link, but you can’t in this context , , if you remove a, the error will be like this:
Element p not allowed as child of element h1 in this context. (Suppressing further errors from this subtree.)
If I understand the question correctly, then the category ID should already be formed in the arResult array, print it and find the correct key, and you can pass the key value through the json_encode () function
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question