Permanently changing Stylesheet using Javascript

J

Jacqueline

Hi,

I would like to be able to write some code in Javascript preferably
(PHP is also all right) which allows the admin of a website to be able
to change stylesheet attributes from a GUI browser interface without
having them to change the text file themselves. (i.e., working on the
supposition that the admin is IT illiterate). Simple things like
table heading colours, backgrounds, font sizes need to be changed this
way.

The browser should then read from the changed textfile the next time
the site is refreshed and it should therefore be permanent. Is this
at all possible? If so, how do I update the textfile?

Any help would be appreciated.

Many thanks,

Jacqueline
 
F

Fabian

Jacqueline hu kiteb:
Hi,

I would like to be able to write some code in Javascript preferably
(PHP is also all right) which allows the admin of a website to be able
to change stylesheet attributes from a GUI browser interface without
having them to change the text file themselves. (i.e., working on the
supposition that the admin is IT illiterate). Simple things like
table heading colours, backgrounds, font sizes need to be changed this
way.

The browser should then read from the changed textfile the next time
the site is refreshed and it should therefore be permanent. Is this
at all possible? If so, how do I update the textfile?

Cant be done in javascript. Javascript cant write to a file (except in
cookies), although it can generate text which can then be c&p into a
text file.
 
J

Jacqueline

Shame it cannot be done in Javascript, but I guess I understand the
reasons for this - being a client side language I guess the security
risk would be huge!!

Have been looking at doing it in PHP, and have come up with two
distinct ways of doing this:-

1) PHP creates stylesheet text file based on entries on form on
webpage.
2) MySQL database table stores key/value pairs for stylesheet
attributes, then a function goes through the table and creates the
stylesheet on the fly (i.e., every webpage needing the stylesheet runs
the function at the top).

Any suggestions on which would be the most efficient/easiest to
implement etc. (or any other ideas on how to do this!!) ?

Many thanks,

Jacqueline
 
T

Thomas 'PointedEars' Lahn

Jacqueline said:
Shame it cannot be done in Javascript, but I guess I understand the
reasons for this - being a client side language

No, and Fabian's answer was incorrect. It *can* be done with JavaScript.
However, it *cannot* be done with *client-side* JavaScript.
I guess the security risk would be huge!!

Exactly.


PointedEars
 
F

find clausen

Hi,

I would like to be able to write some code in Javascript preferably

Jacqueline

Check my site, got to the controlpanel,
and see it this is what you want ....
 
K

Kien

You can do this using server-side javascript (eg. with ASP).
By using an include file that keeps the style sheet,
user can be allowed to change it by posting info from a form.
Kien
 
D

DJ WIce

Jacqueline,

If it's the admin, why don't he/she just upload a new stylesheet file?
You said the person must be "IT illiterate" so I think you can assume he/she
can write CCS files. Am I right?
If you don't want the admin to change all posible style things (table width
etc.)
Just make two stylesheets and let him/her only edit one (and load that one
first).

Wouter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top