    <?php
      require_once "../lib/viewer_functions.php";
      $options = array();                  // NOTE: see online documentation for more details on these options
      $options['tableName']  = 'demo';  // (REQUIRED) MySQL tablename to list record from. Example: 'article';
      $options['titleField'] = 'title';    // (optional) MySQL fieldname used in viewer url for search engines. Example: 'title' would display: viewer.php/article_title_here-123
      $options['viewerUrl']  = 'demoPage.php'; // (optional) URL of viewer page. Example: '/articles/view.php';
      $options['perPage']    = '9999';         // (optional) The number of records to display per page. Example: '5'; Defaults to 10.
      $options['orderBy']    = 'title';         // (optional) Fieldnames to sort by. Example: 'field1, field2 DESC, field3';
      $options['pageNum']    = '1';         // (optional) Page number of results to display. Example: '1'; Defaults to ?page=# value, or 1 if undefined
      $options['where']      = '';         // (ADVANCED) Additional MySQL WHERE conditions. Example: 'fieldname = "value"'
      $options['useSeoUrls'] = '';         // (ADVANCED) Set this to '1' for search engine friendly urls: view.php/123 instead of view.php?123 (not supported on all web servers)
      list($listRows, $listDetails) = getListRows($options);
 
	// get requested page name
	error_reporting(0);
	$requestedPage = str_replace("/", "", @$_SERVER["PATH_INFO"]);
	if (!$requestedPage) { $requestedPage = "accueil"; }

	// get requested page record
	$pageRecord = null;
	foreach ($listRows as $menuRecord) {
	if ($requestedPage == $menuRecord['filename']) {
		$pageRecord = $menuRecord;
		}
	}

	// error if page not found
	//if (!$pageRecord) { 
		//header("HTTP/1.1 404 Not Found");
		//print file_get_contents("404.htm");
		//exit;
	//}

	// remove all tags and reutnr first NNN words of content 
	error_reporting(0);
	function getTextSummary($value, $maxWords = 25) {   
		$textOnly = preg_replace("/<(.*?)>/s", " ", 
		$value); // strip tags   
		$words    = preg_split("/\s+/", $textOnly);   
		$words    = array_splice($words, 0, $maxWords);   
		$summary = join(" ", $words);   
		return $summary; 
	}
 ?>


<?php echo "<?xml version='1.0'?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- change this to the title you want to appear in browser title bar -->
<title>...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="" />
<meta name="description" content=" " />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="outer">
<div id="wrap">
<!-- the title that appear in the page header -->
<div id="title">...</div>
<div id="header"></div>
<div id="navcontainer">



<!-- show menu -->
<ul id="navlist">
  <?php
     foreach ($listRows as $menuRecord):
       $pageLink   = "../{$menuRecord['filename']}/";
       $isSelected = $requestedPage == $menuRecord['filename'];
   ?>

     <?php if ($isSelected): ?>
        <li><a href="<?php echo $pageLink; ?>"><?php echo $menuRecord['title'] ?></a></b></li>
     <?php else: ?>
        <li><a href="<?php echo $pageLink; ?>"><?php echo $menuRecord['title'] ?></a></li>
     <?php endif ?>
  <?php endforeach ?>
</ul>
<!-- /show menu -->

</div>
<div class="content">
<!-- here is your page content -->

<div class="pullquote"> 
<p>...</p>
</div>


<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
  Keyword: <input type="text" name="content_keyword" value="" size="15">
<input type="submit" name="" value="Search">
</form>


  <!-- STEP2: Display Record List (Paste this where you want your records to be listed) -->
	<?php foreach ($listRows as $record): ?>
	
	<b><?php echo $record['title'] ?></b><br />
	<?php
		$record['content'];
		print getTextSummary($record['content'], 40);
		print (" ...<br />");
	?>
	<a href="<?php echo $pageLink; ?>"><?php echo $pageLink; ?></a><br /><br />
    <?php endforeach ?>

	
    <?php if ($listDetails['noRecordsFound']): ?>
      No records were found!<br/>
    <?php endif ?>

    <?php if ($listDetails['invalidPageNum']): ?>
      Results page '<?php echo $listDetails['page']?>' not found, <a href="<?php echo $listDetails['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/>
    <?php endif ?><br/>
  <!-- /STEP2: Display Record List -->



  <!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
    <?php if ($listDetails['prevPage']): ?>
      <a href="<?php echo $listDetails['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $listDetails['page'] ?> of <?php echo $listDetails['totalPages'] ?> -

    <?php if ($listDetails['nextPage']): ?>
      <a href="<?php echo $listDetails['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?>
  <!-- /STEP3: Display Page Links -->

<!-- end page content -->
</div>
<div id="footer"><br />
...
</div>
</div>
</div>
</body>
</html>