[PHP] Error in creating BTML(BT Markup Language)

2003-10-13 Thread Bas
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



Re: [PHP] Error in creating BTML(BT Markup Language)

2003-10-13 Thread Pavel Jartsev
Bas wrote:

 ...

echo IMG SRC=\ . $bttags['image'] . \;


Seems that U don't have closing double-quote () in line above.
It should be:
echo IMG SRC=\ . $bttags['image'] . \;

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


Re: [PHP] Error in creating BTML(BT Markup Language)

2003-10-13 Thread Bas
Now I get the output:

(in html, if you get a mail, you get the real output.)

HTMLHEADTITLEWelcome!
/TITLE/HEADBODYH1Welcome!
/h1brbr /
bNotice/b:  Undefined index:  text in bC:\pub\include\btml.php/b on
line b13/bbr /
IMG SRC=noimage.gif
/body/html
Pavel Jartsev [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Bas wrote:
 
   ...
  
  echo IMG SRC=\ . $bttags['image'] . \;
  

 Seems that U don't have closing double-quote () in line above.
 It should be:

 echo IMG SRC=\ . $bttags['image'] . \;


 -- 
 Pavel a.k.a. Papi


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