Re: Yes!!! BTML v1.0 is here!!!

From: Date: Wed, 15 Oct 2003 11:04:05 +0000
Subject: Re: Yes!!! BTML v1.0 is here!!!
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-166192@lists.php.net to get a copy of this message
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" <ng@xemoc.cjb.net> wrote in message news:20031013172912.37407.qmail@pb1.pair.com... > <?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>"; > > > ?>

« previous php.general (#166192) next »