ビューアを独自のページに埋め込む

Viewer を専用サイトに最もシンプルに組み込むには、独自のページ レイアウト用フレーム、および Viewer 用フレームを含む フレーム セットを作成します。『開発者用ガイド』のサンプルでは、この方法を使用しています。サンプルのメイン ページである main.php ではフレームを作成し、セットの上部のフレームにはサイト専用のページ ヘッダ、下部のフレームには埋め込みビューアを表示します。次のコードには、main.php の重要な部分が含まれています。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" 
"http://www.w3.org/TR/html4/frameset.dtd">
<?php
require_once('common/common.php');
 
try
{
  // Initialize the web extensions,
  MgInitializeWebTier ($webconfigFilePath);
 
  // Connect to the site server and create a session
  $userInfo = new MgUserInformation("Author", "author");
  $site = new MgSite();
  $site->Open($userInfo);
}
catch (MgException $e)
{
  echo "Could not connect to the MapGuide site server.";
    die();
}
 
try
{
  $sessionId = $site->CreateSession();
 
  // Define some constants
  $webLayout = "Library://Samples/Layouts/SamplesPHP.WebLayout";
  $title = "Samples";
}
catch (MgException $e)
{
  echo "ERROR: " . $e->GetMessage("eng") . "\n";
  echo $e->GetStackTrace("eng") . "\n";
}
?>
 
<html>
  <head>
    <title><?= $title ?></title>
  </head>
 
  <frameset rows="110,*">
    <frame src="common/Title.php?TitleText=<?= $title ?>" 
      name="TitleFrame" scrolling="NO" noresize />
    <frame
    src="/mapserver2012/mapviewerajax/?
    SESSION=<?= $sessionId ?>&
    WEBLAYOUT=<?= $webLayout ?>" name="ViewerFrame" />
  </frameset>
</html>