Working With PHP

From the version 2.3 Sitecake started working with PHP files. If you are using Sitecake with a PHP website, there are several things to know:

  • Complete sc-content element should be contained inside a single file. Opening sc-content element in one file and closing it in another would not work.

  • PHP code inside sc-content element will be overwritten with rendered HTML after first save/publish

  • Paths used in php include and require methods that contain editable content should be relative because Sitecake creates copies of your website files and works with copies. If used paths are full paths, Sitecake will always include original files. If you make changes to sc-content element that is located inside an included file, page refresh would not be enough to see the changes, you should have to publish the page to be able to see the changes.
    On the other hand, if you want to include configuration file or file where you defined functions you use in your pages, you should use full path for inclusion. So, for example, if you want to include config file that is outside of your site root, you could use include_once($_SERVER['DOCUMENT_ROOT'] . '/../config.php);

Sitecake files and folders

Here is the short description of things found in sitecake/ folder.

    2.3.1/                   version folder
        client/              editor
        config/              configuration files
            bootstrap.php    application bootstrap
            check.php        environment check
            config.php       Sitecake configuration
        locale/              translation .yml files
        src/                 server source files
            Sitecake/        Sitecake classes
            app.php          services entry point
        vendor/              third party libraries
    credentials.php          credentials file
    credential.php.default   reset credentials file
    editor.cnf               editor configuration
sitecake.php                 application entry point


Sitecake suports memcache, memcached and redis session handling.