Greetings Tell a newbie in Bitrix where to find the tempale.php file? I have not worked with this CMS before. And now for the work I drove the site to Bitrix , I need to add мета-теги , тайтл .

Found a manual how to do it. It seems to be easy, simply by adding a specific line to the tempale.php file:

 <? $APPLICATION->AddHeadString('ваш_код',true)?> 

And I, damn it, I do not know where to find it - this file.

Basically, I figured out where to change the html page code. But these changes are possible for the body section tags. And to add new мета to the head is not possible.

Where to dig? I work with битриксом for the first time. Thank!

    1 answer 1

    Well, it is clear that previously did not work with Bitrix.

    Given that Bitrix works on components, then you need to first find out exactly which component is used on the page that you need.

    For example, in the catalog, it will most likely be bitrix: catalog, but there are also custom recorders, you can find out which component by going to the index page of the section you need. For example, you need to register meta tags for products.

    The path of each product is as follows: site.ru / catalog / product code / In this case, go to the catalog folder in the project and open index.php to see what components it contains. There may be several. In this example, we will need bitrix: catalog. Well, here how lucky. Either the developers did everything according to the rules and created a site template in the / local / templates / folder or NOT according to the rules in the / bitrix / templates / folder in any case, our template.php will be located along these paths (and see for yourself how it is implemented) :

    1) If according to the rules the custom component / local / components / space_name_ to_ to which_component_component_name / component / name / template name / template / php is assigned

    2) If according to the rules a custom component, but its template in the site template / local / templates / name_site_companying_name/components/space_space_name_to_to which_component_specific_name/template.php_name_php_

    3) if the custom BUT NOT BY THE RULES, then the 2 upper cases, only instead of the local folder, will be a bitrix folder.

    4) If a standard component according to the rules / local / templates / site_name_company/components/bitrix/_component_name / component_time_name/template.php

    5) If a standard component, BUT NOT by the rules, then the 4th item, instead of local, will be bitrix

    Here are the ways where your template.php can be stored.

    You recognize which site template, through the admin panel, on index.php in the right directories, find out which component is needed and which template. eg

    $ APPLICATION-> IncludeComponent ("samovar: user.profile", "profile" ..

    This is a custom component, samovar is a space, user.profile is the name of the component, profile is a template. Therefore, according to the rules, the path to tempate.php will be as follows:

    /local/components/samovar/user.profile/templates/profile/template.php

    But your problem will not solve it! You do not even need template.php, but component_epilog.php

    Because the components of Bitrix cache their templates and just your values ​​will be cached for different products, the same tags will be) component_epilog.php is NOT cached.

    In general, META tags can be set in the setting of the element in the admin panel in the SEO tab, and for pages through the front office through the control panel. In the component, set the checkbox in the parameters, "set keywords", "page description", etc. Similarly. Even if it is done through code, it is clearly not using

    $ APPLICATION-> AddHeadString ('your_code', true)

    And through $ APPLICATION-> SetPageProperty ('property code', 'string');

    The title is set via $ APPLICATION-> SetTitle ('string');

    Well, and this is not all. Bitrix is ​​a fucking dark forest where you can do the same thing in the same way in the 500,500 ways.

    If that component_epilog.php should be NEXT with template.php. If it is not there, then it needs to be created and the first thing to do in it is to add the Bitrix prologue.

    • Thank you so much! Today I have my first day off in almost 2 weeks. And tomorrow I will surely re-read everything you have written very carefully and with an open admin panel and try to implement it. I made a backup just in case. I hope it works out. I’ll also look at a couple of lessons about cms itself. - Natalya
    • True, fucking dark forest. More capaciously and accurately you will not tell :) Well, for a start, somehow I figured it out. Being on a specific page, go to edit mode -> Site -> Edit Page -> Title and Page Properties. The only thing I have not yet understood, what is meant by the title of the page? This is not a title, not h1 Any title for the needs of the CMS itself? - Natalya
    • one
      Well, it's hard for me to answer now, because I can't see all the subtleties. The title of the page may be implied: 1) <meta name = "title"> 2) or the name of the tab in the browser But not exactly H1, since you stretch H1 in the template yourself. for example: <h1> <? $ APPLICATION-> ShowTitle ()?> </ h1> - it-blog.club