Mecha CMS

Mecha CMS blog and documentation.

Make the Manager Pages Different with the Blog Page

Updated: Sunday, 07 August 2016

How to make your manager page looks different with the blog page.

There are several ways to achieve it. One thing you should know is that the entire layout of your manager page depends only on the manager.php file of your shield. So you only need to focus on that file.

To make the manager page (backend page) looks different with the blog page (frontend page), you have to create some special files to be included in the manager.php file.

This is considered as a normal manager.php file content:

<?php include 'header.php'; ?>
<?php include 'sidebar.php'; ?>
<div class="blog-posts">
  <article class="post">
    <h2 class="post-title"><?php echo $config->page_title; ?></h2>
    <div class="post-body">
      <?php if($cargo = File::exist($config->cargo)) include $cargo; ?>
    </div>
  </article>
</div>
<?php include 'footer.php'; ?>

And this is the way to make the manager page looks different with the blog page:

<?php include 'header.backend.php'; ?>
<?php include 'sidebar.backend.php'; ?>
<div class="blog-posts">
  <article class="post">
    <h2 class="post-title"><?php echo $config->page_title; ?></h2>
    <div class="post-body">
      <?php if($cargo = File::exist($config->cargo)) include $cargo; ?>
    </div>
  </article>
</div>
<?php include 'footer.backend.php'; ?>

Just create additional PHP files named as header.backend.php, sidebar.backend.php and footer.backend.php. You can play around with those files. For example, injecting some different stylesheet files, creating different HTML markup, etc.

Or, if it is only a matter of CSS, you can utilize the page types to be used as HTML class like this:

<html class="page-<?php echo $config->page_type; ?>">

And the CSS example:

/* Global Layout */
.nav {}
.main {}
.sidebar {}
.footer {}

/* Manager Layout */
.page-manager .nav {}
.page-manager .main {}
.page-manager .sidebar {}
.page-manager .footer {}

Related: Backend Appearance as ‘Normal’ Shield

Donation and Email Subscription