06 Sep 2023

MonoCMS 2.2 - Page path & advanced settings

Another big update gives the ability to choose a path for a page.

Other updates include

- A new 'advanced settings' control panel page.
- A new path.php page to replace some of the pagep.php funcionality and, finally, completely separate the core of the cms from the rest.

- A fix in pages.php causing a miscalculation in array iteration and messing with the results per page.
- Page results navigation is improved.
- Multiple new options, like setting a limit to posts results or a custom home page for the control panel.
- A few design changes.



How to enable path option for pages

If this is your first installation or you don't care to create pages in different catalogues, but only your home dir, you don't have to do anything.

If you update from an older version, you need to make a small change in pagep.php.

Open pagep.php in a text editor and replace the code that is shown below:


        # find inclusion path
        $rot = (is_dir('monofiles')) ? '' : '../../';
        $lot = ($rot == '') ? './' : '../../';
        
        include_once $rot.'monofiles/log.php';
        include $rot.'monofiles/en_code.php';


        # CMS settings
        $cms = cmsetup();  

 


With this:

if (!isset($rot)) {

      # find inclusion path
        $rot = (is_dir('monofiles')) ? '' : '../../';
        $lot = ($rot == '') ? './' : '../../';
        
        include_once $rot.'monofiles/log.php';
        include $rot.'monofiles/en_code.php';


        # CMS settings
        $cms = cmsetup(); 
 }



That's it. You can now support pages in different paths.

As mentioned, this part of the code is transfered in the core of the cms, in a new file named path.php. Pages and posts include the new file instead of the above, since version 2.2.