Activation
In order to activate Marmoset for the PHP pages you want, edit each PHP page and add the following:
Header
At the beginning of the file (immediately, before any other text) insert the following lines.
<?php
if (!defined("CALAISMF_INCLUDE_DIR")) define("CALAISMF_INCLUDE_DIR", "path/to/calaismf/");
require_once (CALAISMF_INCLUDE_DIR . "header.php");
?>
Replace the words path/to/calaismf/with the actual path. Note that the path you specify is relative to the location of the PHP page available to the search robot, so if different PHP pages are placed in different locations, the header stub will have to be changed accordingly.
Important: Make sure you include the last forward slash ( / ) in the path.
Footer
At the end of the file (after any other text) insert the following line:
<?php require_once (CALAISMF_INCLUDE_DIR . "footer.php"); ?>
Once the header and footer are added, Marmoset is activated for the page.
Example
Consider the following PHP page:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
<?php echo "Testing page for Microformats"; ?>
</title>
</head>
<body>
<?php
$h1 = "This is the Microformats test page";
$text = "Sample text Sample text Sample text Sample text Sample text Sample text";
echo "<h1>".$h1."</h1>\n";
echo "<div>\n".$text."\n</div>\n";
?>
</body>
</html>
In order to activate Marmoset for this page add the header and footer as follows:
<?php if (!defined("CALAISMF_INCLUDE_DIR")) define("CALAISMF_INCLUDE_DIR", "../calaismf/"); require_once (CALAISMF_INCLUDE_DIR . "header.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title> <?php echo "Testing page for Microformats"; ?> </title> </head> <body> <?php $h1 = "This is the Microformats test page"; $text = "Sample text Sample text Sample text Sample text Sample text Sample text"; echo "<h1>".$h1."</h1>\n"; echo "<div>\n".$text."\n</div>\n"; ?> </body> </html> <?php require_once (CALAISMF_INCLUDE_DIR . "footer.php"); ?>
In this example we assume the page is located under /var/www/html/pages and the calaismf directory is at /var/www/html/calaismf.
Which Pages to Activate
Activate any PHP page for which semantic data can help. Keep in mind the following:
- The page must be processed as a PHP page by the Web server (usually it means it has a .php extension)
- The page should be reachable by search robots. This usually means you can follow links from your index page to reach it, or that you had submitted it to search engines specifically
- There is no need to add the header and footer to PHP pages that are not visible, and are only included/required by other PHP pages
- The page must return content of type text/html
