I am trying to make an BTML-parser.

(BTML-Some Markup Language invented by Me)

I have 3 files:

read-tags.php:
---
<?php
function parseTags($file) {
  /* readfile... here */
  $filedata = file_get_contents($file);
  $tag_match = "!<bttag=(\w*)>\s*([^<]*)\s*</bttag>!is";
  preg_match_all($tag_match, $filedata, $matches);
  for ($i=0; $i< count($matches[0]); $i++) {
    $tagname = $matches[1][$i];
    $tags[$tagname] = $matches[2][$i];
  }
  return $tags;
}
?>
---
btml.php:
---
<?php
// You can write precisely 1 image on the bottom,
// 1 title
// and 1 paragraph(you need also the <br>s in your <bttag=text>)
include_once("read-tags.php");
$filename = $_GET['name'];
$bttags = parseTags($filename);

if ($bttags['btml'] == '') {
echo "<HTML><HEAD>";
echo "<TITLE>" . $bttags['title'] . "</TITLE></HEAD><BODY>";
echo "<H1>" . $bttags['title'] . "</h1><br>";
echo $bttags['text'];
if (!isempty($bttags['image'])) {
echo "<IMG SRC=\"" . $bttags['image'] . "\">;
}
echo "</body></html>";
}
?>
---
and an test.btm file
---
<bttag=btml>
</bttag>
<bttag=title>
Welcome!
</bttag>
<bttag=text>
Welcome to my BTML page!!! This is an experimentally version of HTML!!!
<br>Bye!!!
</bttag>
<bttag=image>
noimage.gif
</bttag>
---

I can run this file(btml.php?name=test.btm)
and it gives me this error:
Parse error: parse error, unexpected '/' in C:\pub\include\btml.php on line
17
Can you help me out?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to