Skip to content

Commit

Permalink
Modularize parser and decoder functions for future addition of other …
Browse files Browse the repository at this point in the history
…teletext file formats
  • Loading branch information
fabianswebworld authored Jul 18, 2023
1 parent e4832a1 commit fd81810
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions includes/ttxweb_main.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<?php

// ttxweb.php EP1 teletext document renderer
// version: 1.2.0.606 (2023-07-17)
// version: 1.2.0.608 (2023-07-18)
// (c) 2023 Fabian Schneider - @fabianswebworld

// global constants

const TTXWEB_VERSION = '1.2.0.606 (2023-07-17)'; // version string
// global definitions
const TTXWEB_VERSION = '1.2.0.608 (2023-07-18)'; // version string

// for user and template configuration see ttxweb_config.php

// valid get URL parameters:

// level15 - 0 (decode only level 1.0 characters) | 1 (decode level 1.5 characters, default)
// header - 0 (show locally generated header, default) | 1 (show actual row 0 from EP1 file)
// page - 100 (default) .. 899 - the page number to be displayed
Expand All @@ -25,7 +23,7 @@ function getPageNumbers() {
// get page number and infer EP1 filename
// also get existing pages and prev and next page

global $pageNum, $subpageNum, $prevPageNum, $nextPageNum, $prevSubpageNum, $nextSubpageNum, $numSubpages, $ep1FileList;
global $pageNum, $subpageNum, $prevPageNum, $nextPageNum, $prevSubpageNum, $nextSubpageNum, $numSubpages;

$pageNum = isset($_GET['page']) ? $_GET['page']:'100';
$pageNum = sprintf("%03d", $pageNum);
Expand Down Expand Up @@ -160,7 +158,10 @@ function getEp1Filename($pageNum, $subpageNum) {
include('ttxweb_decoder.php');

// now, render the given EP1 file
renderEp1File(getEp1Filename($pageNum, $subpageNum));
renderTeletextFile(getEp1Filename($pageNum, $subpageNum), $level15, $reveal);

// add version string to output
echo '<!-- generated by ttxweb EP1 teletext document renderer version: ' . $versionString . ' -->' . "\n";

// include navigation
include($templateFolder . '/navigation.php');
Expand Down

0 comments on commit fd81810

Please sign in to comment.