Loading...
Loading...
Covers CMS fundamentals — sites, site templates, menus, page templates, includes, breadcrumbs, styles/CSS handling (styles.css vs template_styles.css, Asset::addCss, SetAdditionalCSS), user groups, user fields, admin panel. Applied for site structure and content management tasks. Key terms — CSite, template, menu, include area, styles.css, SetAdditionalCSS, user field, UF.
npx skill4agent add bxmaximum/bitrix-framework-skills bitrix-cms-basicsbitrix-landing\Bitrix\Main\SiteTableb_langmain/lib/SiteTable.phpCSiteLIDs1NAMEDIRDOC_ROOTSERVER_NAMESITE_NAMELANGUAGE_IDCULTURE_IDACTIVEDEF$site = \Bitrix\Main\SiteTable::getRow([
'filter' => ['=LID' => SITE_ID],
'select' => ['LID', 'DIR', 'SERVER_NAME', 'DOC_ROOT', 'LANGUAGE_ID'],
]);
$docRoot = \Bitrix\Main\SiteTable::getDocumentRoot(SITE_ID);SITE_IDSITE_DIRSiteTable::getByDomain($host, $directory)/local/templates/<template_id>//local/templates/mytemplate/
├── header.php
├── footer.php
├── description.php # Template meta ($arTemplate), incl. EDITOR_STYLES
├── styles.css # Content styles — also loaded by the visual editor
├── template_styles.css # Template frame styles (header/footer/grid)
├── .styles.php # Visual editor style list entries
├── components/ # Template-level component overrides
├── page_templates/ # Page layout templates
└── lang/#WORK_AREA#header.phpfooter.php#WORK_AREA#/local/templates//bitrix/templates/| Owner of markup | Where CSS lives |
|---|---|
Site frame ( | |
| Page content that must be styleable in the visual editor | |
Component template markup ( | |
JS-extension UI loaded via | CSS inside the extension ( |
| One-off page CSS | |
styles.csstemplate_styles.cssstyles.css<head>template_styles.css.styles.phpstyles.cssreturn [
'example' => [ // array key = CSS class name
'tag' => 'p', // tag(s) the style applies to; comma-separated list allowed
'title' => 'Test style', // name shown in the editor
'html' => '<span style="...">Preview</span>', // optional styled preview
// optional 'section' => groups entries in the editor's style dropdown
],
];EDITOR_STYLESdescription.php$arTemplate'EDITOR_STYLES' => ['/bitrix/css/main/bootstrap.css', ...]$APPLICATION->ShowCSS(); // classic, in header.php <head>: outputs page + template CSS set
$APPLICATION->SetAdditionalCSS('/local/templates/demo/additional.css'); // classic add to that set
\Bitrix\Main\Page\Asset::getInstance()->addCss(SITE_TEMPLATE_PATH . '/styles/page.css');
// 2nd param $additional=true → file goes to the template set, after styles.css / template_styles.css
\Bitrix\Main\UI\Extension::load('demo.product-card'); // extension JS+CSS from its config.phpAsset::addCss()Extension::load()ShowCSS()SetAdditionalCSS()mainoptimize_css_files.mincompres_css_js_filesdisableOptimizeCss()/bitrix/cache/css/<SITE_ID>/<template>/template_<hash>page_<hash>.section.php<?php
$sSectionName = 'News';
$arDirProperties = [
'TITLE' => 'News section',
'keywords' => 'news, updates',
'description' => 'Company news',
];$sSectionNameGetNavChain$arDirProperties$APPLICATION->GetDirProperty()$APPLICATION->GetProperty().access.phpPERM[...]$APPLICATION->SetFileAccessPermission()$APPLICATION->SetPageProperty('title', 'About');
$APPLICATION->SetPageProperty('description', 'About the company');
$APPLICATION->SetPageProperty('keywords', 'about');
$title = $APPLICATION->GetPageProperty('title', 'Default');
// GetProperty: page first, then directory (.section.php), then default
$desc = $APPLICATION->GetProperty('description');SetPagePropertyGetPagePropertySetDirPropertyGetDirProperty.section.phpGetPropertytitledescriptionkeywordstopleft/.top.menu.php/.left.menu.phpbitrix:menu/local/templates/<id>/page_templates/bitrix:main.include$APPLICATION->IncludeComponent('bitrix:main.include', '', [
'AREA_FILE_SHOW' => 'file',
'PATH' => '/include/phone.php',
]);/include//local/include/$sSectionName.section.php$APPLICATION->AddChainItem('Title', '/path/')bitrix:breadcrumbCUser\Bitrix\Main\UserTable\CMain::GetUserRight()CUserTypeEntity\Bitrix\Main\UserFieldTableDoInstallUSER.UF_*/bitrix/admin/bitrix-uiCAdminListCAdminFormSITE_IDSITE_DIR#WORK_AREA#/local/templates/template_styles.cssstyles.css.styles.phpstyle.cssAsset::addCss()Extension::load().section.php.access.phpSetPagePropertyGetProperty.menu.phpbitrix-landing