Re: Split string and retain part before character match?
Posted: Mon Jun 16, 2008 6:43 pm
This essentially lets you continue editing your current theme after each $_POST request where as if this script did not exist then while you would still see your implemented changes (due to the session) you would be starting from scratch. Without this you can only edit a theme once per $_POST, each second+ edit starts from scratch (unintended).
All this information (stored in the session variable) has to be repopulated in to input forms if it is to be retained through multiple $_POST. Let's say you change the body element's background-color on the first edit and $_POST. It's retained in the session and cookie. However the second time you use the editor while the body element will still have that background-color because of the session from your first $_POST without this script is necessary to repopulate your original choice that is currently retained in the session. Otherwise after your second $_POST you'd unexpectidly loose the body element's background-color (and anything else from the original $_POST). You'd have to repeatably edit the same things over and over. Considering there are over a hundred values that can be changed without this script the editor is incomplete and highly likely to anger and frustrate visitors.
It's the same with the selectors only *I'm* the only one who will be editing it at any given point (for the editor at least
). If you look at the source code the input forms have IDs and name values that essentially are structured in the following manner...
ce00 = selector #1
ce01 = background-color for selector #1
ce02 = background-image for selector #1
ce03 = border-color for selector #1
ce04 = color for selector #1
ce10 = selector #2
ce11 = background-color for selector #2
ce12 = background-image for selector #2
ce13 = border-color for selector #2
ce14 = color for selector #2
ce250 = selector #25
The last numerical number represents what chunk of data is being referenced. The first (one or two) numbers after 'ce' represent the selector we're dealing with at the given moment.
I hope that explains the role of what I'm doing in this thread and the last portion of my editor?
In general my next step can be best described with this little tidbit of code below though while hardly standards compliant visually demonstrates that I can pass on the splitting procedures and manually create the variables (and arrays if necessary) for the data to generated by the client instead of the server...and then populated in to the form fields. I can just keep on splitting stuff as necessary from this point obviously.
Any way after this is all done I'm so going to play Face3 with quad jump for like a week straight! 
All this information (stored in the session variable) has to be repopulated in to input forms if it is to be retained through multiple $_POST. Let's say you change the body element's background-color on the first edit and $_POST. It's retained in the session and cookie. However the second time you use the editor while the body element will still have that background-color because of the session from your first $_POST without this script is necessary to repopulate your original choice that is currently retained in the session. Otherwise after your second $_POST you'd unexpectidly loose the body element's background-color (and anything else from the original $_POST). You'd have to repeatably edit the same things over and over. Considering there are over a hundred values that can be changed without this script the editor is incomplete and highly likely to anger and frustrate visitors.
It's the same with the selectors only *I'm* the only one who will be editing it at any given point (for the editor at least
ce00 = selector #1
ce01 = background-color for selector #1
ce02 = background-image for selector #1
ce03 = border-color for selector #1
ce04 = color for selector #1
ce10 = selector #2
ce11 = background-color for selector #2
ce12 = background-image for selector #2
ce13 = border-color for selector #2
ce14 = color for selector #2
ce250 = selector #25
The last numerical number represents what chunk of data is being referenced. The first (one or two) numbers after 'ce' represent the selector we're dealing with at the given moment.
I hope that explains the role of what I'm doing in this thread and the last portion of my editor?
In general my next step can be best described with this little tidbit of code below though while hardly standards compliant visually demonstrates that I can pass on the splitting procedures and manually create the variables (and arrays if necessary) for the data to generated by the client instead of the server...and then populated in to the form fields. I can just keep on splitting stuff as necessary from this point obviously.
Code: Select all
<script>window['ii01'] = 'background-color: #936; background-image: url(general/11/001.gif); border-color: #cc6; color: #cc9;';var properties = new Array();properties=ii01.split(';');document.write(properties[0] + '<br />');document.write(properties[1] + '<br />');document.write(properties[2] + '<br />');document.write(properties[3] + '<br />');</script>