id if the example * * @author Stephan Schmidt * @author gERD Schaufelberger * @package patSession * @subpackage Examples */ require_once 'index_sections.php'; if( !isset( $_GET['example'] ) ) { die( 'No example selected.' ); } $exampleId = $_GET['example']; $section = getExampleSection( $exampleId ); $example = getExample( $exampleId ); $exampleFile = $exampleId.'.php'; $nav = array( 'output' => 'Output', 'source' => 'PHP Source' ); ?> <?PHP echo $appName; ?> example
' . ' ' . '  '; foreach( $nav as $navId => $navTitle ) { $html .= ''.$navTitle.'' . ' '; } $html .= '  ' . ' ' . ''; echo $html; } /** * get the example section * * @access public * @param string example id * @return string section title */ function getExampleSection( $id ) { global $sections; foreach( $sections as $title => $spec ) { if( strncmp( $spec['basename'], $id, strlen( $spec['basename'] ) ) === 0 ) return $title; } return false; } /** * get the example section * * @access public * @param string example id * @return string section title */ function getExample( $id ) { global $sections; foreach( $sections as $title => $spec ) { if( strncmp( $spec['basename'], $id, strlen( $spec['basename'] ) ) !== 0 ) continue; foreach( $spec['pages'] as $name => $data ) { if( $id != $spec['basename'].$name ) continue; if( !isset( $data['templates'] ) ) { $data['templates'] = array( $id.'.tmpl' ); } return $data; } } return false; } ?>