Presenting the parsed HTML code in the browser...
Posted: Sat Aug 23, 2008 1:23 pm
Hi All,
This is not so much a syntax question - more advice as to how to approach the solution...
I'm writing a fairly simple script which enables the user to construct a menu for their website by choosing a variety of style attributes (colours, fonts, text alignment, etc). After generating the menu they should then be able to copy the code from the browser without having to go into the source. So essentially it's in 3 sections on screen...
1: A form presenting the various style options
2: The finished menu generated from the chosen options
3: The parsed HTML code and CSS for the generated menu (to then cut 'n' paste)
This all happens on the same page enabling the user to generate the menu and then change individual attributes and see the results as they go. Each change is effected by resubmitting the page - there is no client-side scripting.
The first two parts I have sorted - but I'm scratching my head as to how to tackle the third. I've got the script to generate the code so that the menu can be seen as a finished product in the browser but then I have to get it to generate the same code again (perhaps in a textarea field) for the user to copy from the browser.
Any suggestions?
Thanks in advance.
Bob.
This is not so much a syntax question - more advice as to how to approach the solution...
I'm writing a fairly simple script which enables the user to construct a menu for their website by choosing a variety of style attributes (colours, fonts, text alignment, etc). After generating the menu they should then be able to copy the code from the browser without having to go into the source. So essentially it's in 3 sections on screen...
1: A form presenting the various style options
2: The finished menu generated from the chosen options
3: The parsed HTML code and CSS for the generated menu (to then cut 'n' paste)
This all happens on the same page enabling the user to generate the menu and then change individual attributes and see the results as they go. Each change is effected by resubmitting the page - there is no client-side scripting.
The first two parts I have sorted - but I'm scratching my head as to how to tackle the third. I've got the script to generate the code so that the menu can be seen as a finished product in the browser but then I have to get it to generate the same code again (perhaps in a textarea field) for the user to copy from the browser.
Any suggestions?
Thanks in advance.
Bob.