Location: PHPKode > projects > LayManSys > laymansys-0.4.0/lib/laymansys.php
<?php
/* $Id: laymansys.php,v 1.7 2006/09/01 12:28:32 robertbienert Exp $
 *
 * LayManSys - new style RDF based Layout Management System
 * This is the main include file. You need only to include (or require)
 * this file to use LayManSys. For auto-generated HTML headers, see the
 * scripts in the laymansys/auto/ directory.
 *
 * Copyright (C) 2005, 2006 Robert Bienert, project LayManSys
 * http://laymansys.sourceforge.net/
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 */

//--	constants

// This constant stands for the LayManSys sub-directory.
define('_LMSP_', 'laymansys/');

/*--	Prepare the include path to find all LayManSys libraries
 *	(requires at least PHP 4.3.0)
 */
set_include_path(get_include_path() .
	PATH_SEPARATOR . dirname(__FILE__));

//--	includes
include_once(_LMSP_ . 'RDFParser.php');		// the RDF parser
include_once(_LMSP_ . 'LayoutParser.php');
include_once(_LMSP_ . 'frame.php');		// HTML head
include_once(_LMSP_ . 'header.php');		// header generation
include_once(_LMSP_ . 'footer.php');		// footer generation
include_once(_LMSP_ . 'config.php');		// some configuration

//--	global objects

//--	public interface

/* 
 * html		string	(X)HTML variant and version
 * options	array	further LayManSys options
 */
function LayManSysHeader($html, $options = array()) {
	//--	variables
	$myOpts = array_merge(LayManSysDefaultHeaderOptions(), $options);
	$meta = array('.DocType.' => $html,
		'.NavFirst.' => $myOpts['.NavFirst.'],
	);

	//--	set handler for errors before HTML output
	set_error_handler('handle1stStageError');

	//--	build $meta
	//	parse the global RDF file
	$rdfParser = new RDFParser($myOpts['default.rdf'], $meta);
	//	parse the files RDF file
	$rdfParser->parseFile($myOpts['my.rdf']);

	// add customized document title
	if (array_key_exists('title', $myOpts) && $myOpts['title'])
		$meta['Title'] = $myOpts['title'];

	// deal with customized layouts
	if ($meta['layout']['layout.cfg']) {
		$lp = new LayoutParser($meta['layout']);
		$lp->mergeStyles($meta['css']);
		$meta['layout'] = $lp->layout();
		$meta['link']['Shortcut Icon'] = $lp->favIcon();
	}

	//--	process $meta for the heading
	writeHeader($meta);

	//--	set handler for errors inside HTML generation
	set_error_handler($myOpts['errHandler']);

	//--	print CMS frame if this is the right place
	if (array_key_exists('nav', $meta['layout']) &&
		$meta['layout']['nav']['position'] == NAV_AH)
	{
		printNavigation($meta);
	}

	return $meta;
}
?>
Return current item: LayManSys