|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to let users apply a .css file via a dropdown menu? w/ or w/o using a database?
Hey!
I would like to write a script that allows users to select .css files from a pulldown menu that is populated by all the .css files located in a given directory. The goal is to "write" the selected file's name into a config file (I assume) so that that particular .css file will be the one used. Then if the user wants to change .css files, they nav. back to the pulldown page and reselect a new .css file. Is this possible? I don't expect that someone will write this for me...but hopefully someone might be able to point me in the right direction... A feature that would allow users to upload (only) .css files would also be excellent...but I realize that would require populating the dropdown with information in my database...(thus negating the first paragraph...) Which method would be better? And how can I go about writing the pulldown selection to a config file? Your wisdom is much appreciated. Thank you. Cranjled PS. If doing this with PHP is not the right way...please don't hesitate to tell me! I only assumed php since my site is in php... |
|
#2
|
||||
|
||||
|
Yes, possible.
You have to decide if you want to give the user the upload feature before you go any further b/c this will change how you approach this. Let us know what you decide. As a pointer, instead of writing to a config file (b/c you'd have one per user), use a cookie to store the choice.
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
|
#3
|
|||
|
|||
|
Thanks Jeremy for the quick reply!
I think I should clarify this... the bold sections below should clear it up... I would like to write a script that allows me to select .css files from a pulldown menu that is populated by all the .css files located in a given directory. The goal is to "write" the selected file's name into a config file (I assume) so that that particular .css file will be the one used when (all) users view the site. Then if I wanted to change .css file, I'd nav. back to the pulldown page and reselect a new .css file. This change would then be viewed by any users on the site. A feature that would allow only me to upload (only) .css files would also be excellent...but I realize that would require populating the dropdown with information in my database...(thus negating the first paragraph...) ...and yes, I'd much like to be able to upload the css files via browser, instead of FTPing them in. Thanks again for your reply! Last edited by cranjled : April 10th, 2004 at 04:00 PM. |
|
#4
|
||||
|
||||
|
you can just set up a folder has all the css files you will use, and a script to upload extra css file to there, just read the contents of the directory to get a list of all css files, when you select one copy to the one that is in use by the site overwriting the old one
|
|
#5
|
|||
|
|||
|
Yes, I understand that it could be done this way...this is how I'm doing it now...but that method is a bit primitive since it requires copy and paste and FTP. What I'd prefer to do is to have a pulldown menu automatically update with all the files in the directory and to automatically apply itself via a pulldown menu selection. The main thing is that it's browser based...and on the fly.
Thanks for your suggestion! |
|
#6
|
||||
|
||||
|
I think what edman007 mean't was using PHP to do exactly what you are doing manually.
It's a little bit messy but basically you'd have two directories - something like: css_all css_current First your script would look in css_current to find the current css file - place the name of this in a variable. Then open the css_all folder and loop through the contents to populate a select menu - using the variable to match the current file from the select menu. When you select a different file from the select menu and submit, the previous file in css_current is deleted and replaced with the one you have chosen. All the functions you need are in the Filesystem functions section of the PHP manual.
__________________
______________ m(_ _)m ______________ fusionbureau design studio - design and stuff in tokyo |
|
#7
|
||||
|
||||
|
yes that is what i'm saying to do but in php, make a form to upload it, this is what the html would look like
Code:
<form action="upload_css.php" method="POST" enctype="multipart/form-data" > <input type="file" name="css" size="50" /> </form> then the php in upload_css.php would have this PHP Code:
and this would change the css being used PHP Code:
then the file change_css.php would have this PHP Code:
of course you will have to add lots of error checking and security stuff but i hope you get the idea Last edited by edman007 : April 10th, 2004 at 08:17 PM. Reason: typo |
|
#8
|
|||
|
|||
|
Thank you, thank you!! Yes, in fact I finally get the idea...that I've bitten off more than I can chew. Ah well...maybe next year... thank you guys for being there.
Don't mind me as I slink back to my corner... |
|
#9
|
|||
|
|||
|
(that's not to say that I'm not going to try!)
|
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > How to let users apply a .css file via a dropdown menu? w/ or w/o using a database? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|