Yes, thanx. I always wanted to make a version where you can use multiple tags of one type. And, what do you find of it? Please rate it 1 to 10 "Comex" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > <?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]; > $tag['tagname'] = $tagname; > $tag['value'] = $matches[2][$i]; > $tags[] = $tag; > } > return $tags; > } > $filename = $_GET['name']; > $bttags = parseTags($filename); > echo "<HTML><HEAD>"; > foreach($bttags as $tag) { > switch($tag['tagname']) { > case 'title': > echo "<TITLE>" . $tag['value'] . "</TITLE></HEAD><BODY>"; > echo "<H1>" . $tag['value'] . "</h1><br>"; > break; > case 'heading': > echo "<H1>" . $tag['value'] . "</h1><br>"; > break; > case 'image': > if (!empty($tag['value'])) { > echo "<IMG SRC=\"" . $tag['value'] . "\">"; > } > break; > case 'text': > echo nl2br($tag['value']); > break; > case 'nl': > echo "<br>\n"; > break; > } > } > > > echo "</body></html>"; > > > ?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php