Surreal lets you include shared content in your pages using PHP, ColdFusion, or Server Side Includes (SSI). This is extremely useful for things like headers, footers, navigation menus, and sidebars where a change made on one page needs to propagate to many pages. When you publish a page that has an include file, Surreal will automatically look for the appropriate file on your server and update its content.
When using include files, make sure that your editable regions are inside of the include files. Do not try to place your include code inside of an editable region, as it is server-side code and will be stripped for security reasons.
By design, Surreal will not follow nested include files.
If you’ve never worked with PHP includes, we wrote a tutorial that will help you get started. The following types of PHP includes are supported in Surreal:
<?php include('includes/sidebar.php'); require('includes/sidebar.php'); include_once('includes/sidebar.php'); require_once('includes/sidebar.php'); ?>
If you need to reference your website root, you can use this syntax:
<?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/sidebar.php'); ?>
Surreal cannot parse other PHP variables, so something like
will not work. You must specify the path and filename in a string inside of the
If your server is running ColdFusion, you can include files using the following syntax:
If SSI is enabled on your server, you can include files using the following syntax. If not, you might be able to enable it. This tutorial should help you get started.
<!--#include virtual="/includes/sidebar.html" -->