This error is not so stupid as a deleted closing ".

Okay, for all of you who missed my code here is it again:

read-tags.php
---
<?php
// Tag Parser v1.1
// v1.0 First release(not working)
// v1.1 Edited:
//     Uses Regular Expressions
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
// BTML-HTML converter v1.0
// v1.0 First release
// 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 (!empty($bttags['image'])) {
echo "<IMG SRC=\"" . $bttags['image'] . "\">";
}
echo "</body></html>";
}
?>
---
and test.btm
---
<bttag=btml>
</bttag>
<bttag=title>
Welcome to BTML page v1!
</bttag>
<bttag=text>
Welcome to my BTML page!!! This is an experimentally version of HTML!!!
<br>Bye!!!
</bttag>
<bttag=image>
noimage.gif
</bttag>
---

Run btml.php?name=test.btm and you will get this error plus good output:

Notice: Undefined index: text in C:\pub\include\btml.php on line 15

All indexes of the other things in $bttags do work.

Can you help me?

(And make other improvements... this is my first major project. You may
change everything and what works, post it or email me)

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

Reply via email to