I am developing a website which works as follows:

1. A user will login to my website and be able to build a static webpage. He can select the design elements (logo, text, theme, layout) for a webpage.
2. This webpage will be dynamically changed as per user's selection and can be saved.
3. After saving the design elements, html and css code files should be generated which are able to produce exactly the same design as per the user selection.

It is something similar to building webpages in Dreamviewer or Frontpage (through the direct selection of design elements)

My queries are as follows:
1. Is there an existing mechanism to achieve this
2. If not, what is most suitable way to implement it
3. How can it be implemented in PHP as an online service

Any pointers regarding this would be very helpful. Looking forward to some guiding responses.