RE: [PHP] Using PHP to read style sheet -- create drop-down?

From: Date: Thu, 03 Jul 2003 09:46:57 +0000
Subject: RE: [PHP] Using PHP to read style sheet -- create drop-down?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-153853@lists.php.net to get a copy of this message
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:squid_66@yahoo.com] Sent: 3. júlí 2003 02:34 To: ofjord@simnet.is 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ð <ofjord@simnet.is> 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:squid_66@yahoo.com] > Sent: 2. júlí 2003 21:58 > To: php-general@lists.php.net > 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

« previous php.general (#153853) next »