CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 10th, 2004, 12:07 PM
cranjled cranjled is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cranjled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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...

Reply With Quote
  #2  
Old April 10th, 2004, 01:38 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,344 jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level)jharnois User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 6 h 26 m 32 sec
Reputation Power: 787
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.

Reply With Quote
  #3  
Old April 10th, 2004, 03:58 PM
cranjled cranjled is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cranjled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old April 10th, 2004, 05:19 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 5 h 1 m 50 sec
Reputation Power: 788
Send a message via AIM to edman007
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

Reply With Quote
  #5  
Old April 10th, 2004, 06:16 PM
cranjled cranjled is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cranjled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
  #6  
Old April 10th, 2004, 06:44 PM
hamutaro's Avatar
hamutaro hamutaro is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Japan/NZ
Posts: 105 hamutaro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 46 sec
Reputation Power: 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

Reply With Quote
  #7  
Old April 10th, 2004, 06:44 PM
edman007's Avatar
edman007 edman007 is offline
Trapped on the forums...help
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Aug 2003
Location: /Users/edman007
Posts: 4,617 edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)edman007 User rank is Major General (70000 - 90000 Reputation Level)  Folding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate FolderFolding Points: 67263 Folding Title: Intermediate Folder
Time spent in forums: 1 Month 3 Weeks 3 Days 5 h 1 m 50 sec
Reputation Power: 788
Send a message via AIM to edman007
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:
<?php
move_uploaded_file
($_FILES['css']['tmp_name'], '/path/to/css/storage/folder/'.$_FILES['css']['name']);
?>


and this would change the css being used

PHP Code:
<form action="change_css.php" method="POST">
<
select name="css">
<?
php
while (false !==($file readdir('/path/to/css/storage/folder/'))){
if (
$file != '.' && $file != '..'){
echo 
"<option value=\"$file\">$file</option>";
}
}
?>
</select>
</form> 


then the file change_css.php would have this

PHP Code:
 copy('/path/to/css/storage/folder/'.$_POST['css'], '/path/to/site/wide/css/file.css'); 


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

Reply With Quote
  #8  
Old April 10th, 2004, 07:59 PM
cranjled cranjled is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cranjled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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...

Reply With Quote
  #9  
Old April 10th, 2004, 08:32 PM
cranjled cranjled is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 5 cranjled User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
(that's not to say that I'm not going to try!)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS 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 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway