My favorites | Sign in
Logo
                
Search
for
Updated Jun 27, 2009 by sproctor
EmbeddingCalendar  

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. Simply create a PHP script something like:

<?php include 'path/to/php-calendar/includes/setup.php'; ?>
<html>
  <head>
    <title>Example Embedded Page</title>
    <link rel="stylesheet" type="text/css" href="path/to/php-calendar/style.css">
  </head>
  <body>
    <h1>Example Page Header</h1>
    <?php include 'path/to/php-calendar/embed.php'; ?>
  </body>
</html>

That's it. You need to include setup.php before any of your HTML because it sets up the cookies in the header, and if you have any text before that setup.php cannot output cookies 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.

Due to poor testing, 2.0 Beta1 has a bug that needs to be worked around if you have your script outside of the php-calendar directory. The top line for this version should read:

<?php $phpc_root_path = 'path/to/php-calendar/'; include 'path/to/php-calendar/includes/setup.php'; ?>

The trailing slash on $phpc_root_path is important. Future versions will not need this extra info, but it won't hurt.


Sign in to add a comment
Hosted by Google Code