Hello! Can you please tell me how to correctly arrange anchor link in the template of the Beatrix component? There is a component template and it is necessary to make it on all pages of this template so that when you click on the top of the page on the "Leave a comment" icon, it will drop down on the same page down to the comments.

Put the anchor in the right place page

<a id="add_comment"></a> 

But I can’t figure out how to make a link so that it is correct for any page compiled using this template. I tried this option:

 <a href="http://сайт.ru/articles/./../#add_comment" ><img src="../articles/peopls/knopka_share.png"></a> 

But with this option is the transition to the main.

So how to correctly place the link in the Bitrix template so that it acts on all the pages of articles?

    2 answers 2

    If we have an anchor and a link on one page

    <a href="#add_comment"></a>

    If you need to go from the list to the comments of the article, the link will be something like this

    <a href="<?=$arItem["DETAIL_PAGE_URL"]?>#add_comment"></a>

    • Neither option works :( For some reason, the link translates to the home page of the site, instead of the desired place on the page - Alla
    • @Alla slash of superfluous you do not have - Mihanik71

    Problem solved in this way. Called the URL of the current page + anchor

     <a href="<?=$APPLICATION->GetCurPage();?>#reviews">Посмотреть отзывы</a> 

    And actually the "anchor" in the right place

     <a id="reviews"></a>