Skip to content

Embedding Guide

sabas edited this page Apr 8, 2013 · 5 revisions

This is one of the things that I get asked about the most, so as of 2.0 Beta1, it is a fairly simple task.

Example page:

    <?php include 'path/to/php-calendar/includes/embed_setup.php'; ?>
        <title>Example Embedded Page</title>
        <h1>Example Page Header</h1>
        <?php include 'path/to/php-calendar/includes/embed.php'; ?>

You need to copy the "static" directory to where your script is, or modify the paths to refer to where you have the "static" directory. Before beta13, putting the static files somewhere else didn't work because some files were included from other parts of the calendar. You need to include embed_setup.php before any of your HTML because it sets up the cookies in the header, and if you have any output before that, the cookies cannot be properly set in the header and your users may not be able to log in.

Include embed.php wherever you want the calendar to appear. "path/to/php-calendar" is either a relative path from your script that is embedding the calendar, or an absolute path. The path for style.css needs to be the path you would access the calendar from the web with. If your calendar directory is not accessible from the web, you need to copy style.css somewhere that is, and change the path appropriately.

If you have an unusual setup, you can modify the variables in embed_setup.php in order to accommodate for that.