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 brs in your bttag=text)
include_once(read-tags.php);
$filename = $_GET['name'];
$bttags = parseTags($filename);
if ($bttags['btml'] == '') {
echo HTMLHEAD;
echo TITLE . $bttags['title'] . /TITLE/HEADBODY;
echo H1 . $bttags['title'] . /h1br;
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!!!
brBye!!!
/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