Views: 4826
Last Modified: 10.04.2014

Editable area of site template

Editable areas of site template are stored as PHP and HTML files that are assigned to the site template with use of the function IncludeFile(). Path to the file with editable area is used as the function parameter:

  <?
    $APPLICATION->IncludeFile(SITE_DIR."include/phone.php",
    Array(),
    Array("MODE"=>"html")
    );
  ?>

To proceed to template editable area modification use the icon displayed in the Edit Mode.

or open for editing file with the necessary area.

Editable area of the certain file or section

Editable areas for file or section are stored as files with names containing a definite suffix. Suffix used for editable areas is defined in site template.

For example, by default, it is implied that:

  • editable areas of certain file must be saved with the "_inc" suffix (suffix is joined to the name of page for which this area will be used): index_inc.php, partners_inc.php.

    Important! File with editable area must be saved in folder of section where this area is supposed to be used.

  • Editable areas of section are stored with the name sect_inc.php in the corresponding section folder. 

To proceed to an editable area creating or editing you can:

  • use the icon displayed in the place intended for editable area show. This icon is displayed in the editable areas show mode;
  • create or open for editing a file with the proper name using the File manager tools.


Editable areas are created on base of templates stored in folders with the names /page_templates/:

  • /bitrix/templates/.default/page_templates/ - in case if this editable area template is utilized for all site templates;
  • /bitrix/templates/<template_ID>/page_templates/ - in case if for this site template are used individual editable areas templates.

If you want the editable areas to be added to the list of available templates of WYSIWYG editor, add the editable area templates manes in the file .content.php.

The file .content.php is stored in the folder /page_templates/ located in the corresponding template directory.

Also the name of utilized template can be defined with use of special parameter while assigning editable area to the site. (see the code spotlighted with blue color in the example below).

Assigning editable areas to site templates is implemented with use of the function IncludeFile(), places in the necessary areas of site template:

<?
$APPLICATION->IncludeFile(substr($APPLICATION->GetCurPage(), 
0, strlen($APPLICATION->GetCurPage())-4)."_inc.php", Array(), 
Array("MODE"=>"html", "NAME"=>GetMessage("PAGE_INC"), "TEMPLATE"=>"page_inc.php"));
?>
<?
$APPLICATION->
IncludeFile($APPLICATION->GetCurDir()."sect_inc.php", Array(), Array("MODE"=>"html", 
"NAME"=>GetMessage("SECT_INC"), "TEMPLATE"=>"sect_inc.php"));
?>


Courses developed by Bitrix24