PHPackages                             dlsamson/bitrix-page-template-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. dlsamson/bitrix-page-template-manager

ActiveLibrary[Templating &amp; Views](/categories/templating)

dlsamson/bitrix-page-template-manager
=====================================

A package for simplifying the creation and management of page templates within a single Bitrix CMS template

00PHPCI passing

Since Nov 25Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/DLSamson/bitrix-page-template-manager)[ Packagist](https://packagist.org/packages/dlsamson/bitrix-page-template-manager)[ RSS](/packages/dlsamson-bitrix-page-template-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Bitrix Page Template Manager
============================

[](#bitrix-page-template-manager)

[![Tests](https://github.com/DLSamson/bitrix-page-template-manager/actions/workflows/tests.yml/badge.svg)](https://github.com/DLSamson/bitrix-page-template-manager/actions/workflows/tests.yml)[![codecov](https://camo.githubusercontent.com/536342035578591ef73d655e45ce31df54c4a85dde6d567f11c9d830e9573d66/68747470733a2f2f636f6465636f762e696f2f67682f444c53616d736f6e2f6269747269782d706167652d74656d706c6174652d6d616e616765722f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/DLSamson/bitrix-page-template-manager)[![PHP Version](https://camo.githubusercontent.com/291fb48c27888cb58d3daa496237532ea2d0bdd51a933f0a7a4262e9d87b7304/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e342d3838393242462e737667)](https://php.net/)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

It is a convenient package for Bitrix CMS that allows developers to easily create and manage page templates inside a single website template. With this tool, you can quickly develop reusable templates that can be used for various pages inside one site template of your web application.

What problem this package is trying to solve?
---------------------------------------------

[](#what-problem-this-package-is-trying-to-solve)

Page Template Manager is designed to solve the problem of the lack of a built-in mechanism in Bitrix for defining different types of pages within a single template. Because of this, developers have to perform a lot of if-else checks both in the code and in the site configuration to determine the current page and connect the appropriate template, which leads to cumbersome and difficult to maintain code.

The package offers a simple solution — the ability to specify the URLs of the pages and their corresponding templates in the configuration. PageTemplateManager automatically detects the current page and connects the desired template, eliminating the need to write a lot of if-else checks and making the code cleaner and more modular.

---

Installation
------------

[](#installation)

```
composer require dlsamson/bitrix-page-template-manager
```

Include the autoloader in your project:

```
require_once 'pathToVendor/autoload.php';
```

🚀 Quick Start
-------------

[](#-quick-start)

Here's everything you need to transform your messy Bitrix template into clean, organized code:

### Basic Setup

[](#basic-setup)

**Step 1:** Create your template structure:

```
/local/templates/main/
└── templates/            ← Your page templates folder
    ├── header.php                    ← Your default main Bitrix header template
    ├── footer.php                    ← Your default main Bitrix footer template
    ├── catalog/
    │   ├── list.header.php           ← Your catalog list page Bitrix header template
    │   └── list.footer.php           ← Your catalog list page Bitrix header template
    └── blog/
        ├── post.header.php           ← Your blog post page Bitrix header template
        └── post.footer.php           ← Your blog post page Bitrix footer template

```

**Step 2:** Initialize in your Bitrix template:

```
