How to check the root of a site in Bitrix

Explore workouts, and achieving AB Data
Post Reply
subornaakter40
Posts: 441
Joined: Tue Jan 07, 2025 4:31 am

How to check the root of a site in Bitrix

Post by subornaakter40 »

How to check the root of a site in Bitrix
CSite::InDir('/about/') checks directories with nesting.

GetCurDir() returns the directory of the current page relative to the site root. This method is not static.

GetCurPage() returns the path to the current page relative to the site root. This is also not a static method. If the current page file is not defined, then the definition of the directory index file will be performed according to the algorithm presented in the description of the GetDirIndex function.

SITE_DIR — path to the current web directory merchant cash advance email marketing of the site.

In the first case, $APPLICATION->GetCurPage() returns the current path from the site root


will be executed for all subdirectories of the about section, i.e. if the path is, then this condition will work.

How to correctly specify the path to files in the root of the site at other levels
Let's assume that in the root of the site there is a folder AAA, in it there is another one - BBB, and in it there is an image fotosnimok.webp. The path to it will look like .

That is, first the address of the site root is written, then after the slash the name of the first nested folder, after the slash the name of the second nested folder (and so on, if there are many folders), and then the name of the file being searched for.

This path is called absolute or full because it contains the protocol (http or https) and all subsequent levels. There is also a relative path, but this article will not discuss it.
Post Reply