Permanently changing Stylesheet using Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacqueline

    Permanently changing Stylesheet using Javascript

    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
  • Fabian

    #2
    Re: Permanently changing Stylesheet using Javascript

    Jacqueline hu kiteb:
    [color=blue]
    > 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?[/color]

    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.


    --
    --
    Fabian
    Visit my website often and for long periods!


    Comment

    • Jacqueline

      #3
      Re: Permanently changing Stylesheet using Javascript

      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

      "Fabian" <lajzar@hotmail .com> wrote in message news:<brdjr3$29 aeb$2@ID-174912.news.uni-berlin.de>...[color=blue]
      > Jacqueline hu kiteb:
      >[color=green]
      > > 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?[/color]
      >
      > 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.
      >
      >
      > --[/color]

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Permanently changing Stylesheet using Javascript

        Jacqueline wrote:
        [color=blue]
        > Shame it cannot be done in Javascript, but I guess I understand the
        > reasons for this - being a client side language[/color]

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

        Exactly.


        PointedEars

        Comment

        • find clausen

          #5
          Re: Permanently changing Stylesheet using Javascript

          On 12 Dec 2003 08:27:23 -0800, jacqui932@hotma il.com (Jacqueline)
          wrote:
          [color=blue]
          > Hi,
          >
          > I would like to be able to write some code in Javascript preferably[/color]

          Jacqueline

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

          --

          find clausen

          Comment

          • Kien

            #6
            Re: Permanently changing Stylesheet using Javascript

            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

            Comment

            • DJ WIce

              #7
              Re: Permanently changing Stylesheet using Javascript

              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


              Comment

              Working...