RE: [PHP] Using PHP to read style sheet -- create drop-down?
| From: | Sævar Öfjörð | Date: | Wed, 02 Jul 2003 22:50:40 +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-153799@lists.php.net to get a copy of this message | ||
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