Sorry, my bad. Replace $hm with $file[$i]. $hm was for my testing purposes and I forgot to change it :)
-----Original Message----- From: J J [mailto:[EMAIL PROTECTED] Sent: 3. júlí 2003 02:34 To: [EMAIL PROTECTED] Subject: RE: [PHP] Using PHP to read style sheet -- create drop-down? It's reading the file but returning a blank drop-down with your example. Where I'm confused is where is $hm defined? --- Sævar Öfjörð <[EMAIL PROTECTED]> wrote: > Sure. You should use file functions like > > http://is.php.net/manual/en/function.fopen.php > http://is.php.net/manual/en/function.fread.php > or > http://is.php.net/manual/en/function.file.php > > to read the file and then maybe > > http://is.php.net/manual/en/function.preg-match.php > > to extract certain elements from the text. > > Here is what i came up with: > > $file=file("whatever.css"); > $total=count($file); > print "<select>\n"; > for($i=0;$i<$total;$i++){ > preg_match("/^[.]?([a-zA-Z])+/",$hm,$matches); > print "<option> ".$matches[0]."\n"; > } > print "</select>"; > > This should output: > <select> > <option> .heading > <option> .headingBold > </select> > > > > -----Original Message----- > From: J J [mailto:[EMAIL PROTECTED] > Sent: 2. júlí 2003 21:58 > To: [EMAIL PROTECTED] > Subject: [PHP] Using PHP to read style sheet -- > create drop-down? > > Is it possible for PHP or maybe javascript+php to > read > in a style sheet (whatever.css) and create a > drop-down > of all the elements within that style sheet? > > CSS contains: > .heading {blah blah size blah} > .headingBold {blah blah size blah bold} > > > Then in PHP I'd like to have a drop down that shows > those elements found in the style: > > <select> > <option> heading > <option> headingBold > </select> > > Is that possible to read in another file to create a > drop-down? > > Thanks in advance! > > __________________________________ > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! > http://sbc.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php