Block Basic Concept

A block is a component of a page that may be displayed more than once in a single page. A block can be duplicated with a different name and appears on another page differently. For each instance copy of a block, it has its own configuration in the registry database. A user-facing frontend page may have multiple blocks. A block can also run an application to emulate running two applications per page. For example: the "Menus" block is actually running the "Menus" application to display one or menu categories in a page.

Blocks are usually displayed per category in the theme, although you can manually call to display just a single block. For instance, take a look at the following figure and you will see calls to SCHLIX\cmsPageOutput::BlockCategory.

Example 1: Bootstrap 3 menu using the category "menu_top"

            <nav class="navbar navbar-default navbar-static-top">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>                       
                    </div>
                    <div id="navbar" class="navbar-collapse collapse">
                        <?= SCHLIX\cmsPageOutput::BlockCategory('menu_top'); ?>
                    </div>
                </div>
            </nav>

Example 2: Various blocks, coupled with if/else statements

    <?= SCHLIX\cmsPageOutput::BlockCategory('front_slideshow'); ?>
    <!-- You can change SCHLIX frontpage application from Global System Configuration -->
    <!-- Try switching this from landing  to html or blog -->
    <?php global $Application ?>        
    <?php if ($Application->getApplicationName()=='landing'): ?>
        <!-- landing page -->
        <section id="display-frontpage">            
                <?= SCHLIX\cmsPageOutput::ApplicationBody() ?>
            
        </section>            
        <!-- landing page -->
    <?php else: ?>
            <!-- blog rows not using {insertblockbyposition} -->
            <?php if (SCHLIX\cmsPageOutput::BlockCountInCategory('front_extra_row1') > 0): ?>
            <div class="front_extra_row1">    
                <div class="container">
                    <div class="row">
                            <?= SCHLIX\cmsPageOutput::BlockCategory('front_extra_row1') ?>
                    </div>
                </div>
            </div>
            <?php endif ?>
            <!-- row -->    
            <?php if (SCHLIX\cmsPageOutput::BlockCountInCategory('front_extra_row2') > 0): ?>
            <div class="front_extra_row2">    
                <div class="container">
                    <div class="row">
                            <?= SCHLIX\cmsPageOutput::BlockCategory('front_extra_row2') ?>
                    </div>
                </div>
            </div>
            <?php endif ?>
            <!-- row -->
            <?php if (SCHLIX\cmsPageOutput::BlockCountInCategory('front_extra_row3') > 0): ?>
            <div class="front_extra_row3">
                <div class="container">
                    <div class="row">
                            <?= SCHLIX\cmsPageOutput::BlockCategory('front_extra_row3') ?>
                    </div>        
                </div>
            </div>    
            <?php endif ?>
            <!-- display-page -->
            <div class="container">
                <section id="display-frontpage">
                    <?= SCHLIX\cmsPageOutput::ApplicationBody() ?>
                </section>        
            </div>
        <?php endif ?>
   <!-- bottom -->


    <section id="bottom">
        <div class="container wow fadeInDown" data-wow-duration="1000ms" data-wow-delay="600ms">
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="widget">
                        <?= SCHLIX\cmsPageOutput::BlockCategory('footer1') ?>
                    </div>    
                </div><!--/.col-md-3-->

                <div class="col-md-3 col-sm-6">
                    <div class="widget">
                        <?= SCHLIX\cmsPageOutput::BlockCategory('footer2') ?>
                    </div>    
                </div><!--/.col-md-3-->

                <div class="col-md-3 col-sm-6">
                    <div class="widget">
                        <?= SCHLIX\cmsPageOutput::BlockCategory('footer3') ?>
                    </div>    
                </div><!--/.col-md-3-->

                <div class="col-md-3 col-sm-6">
                    <div class="widget">
                        <?= SCHLIX\cmsPageOutput::BlockCategory('footer4') ?>
                    </div>    
                </div><!--/.col-md-3-->
            </div>
        </div>
    </section><!--/#bottom-->

 

Then compare it with how the blocks are categorized in the backend. Notice how the orange folder on the left, which represents the block categories. Each block category may contain one or more blocks, which may be an instance copy of another block from other or the same category.

SCHLIX CMS Blocks backend admin view