Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
08-04-2007, 04:54 PM #1
- Join Date
- Jul 2007
- Thanked 0 Times in 0 Posts
Streamlining code and variable passing...
First off, thanks for having a nice easy to read coding forums. Greatly appreciated.
My web based program can be seen here: http://www.squirrelpf.com/~turbocalc/beta/
As you can see, I allow people to hot link either their configuration or the image that is generated on the fly. Of course it uses an insanely long URL because I pass all the data thru it. What is worse, is the series of strings I wrote just to write that data to those fields.
So how can I streamline that part? I would love to have that entire thing down to a short burst of data. Is that possible and worth it? Would it require a large bit of recoding?
08-04-2007, 05:40 PM #2
- Join Date
- Sep 2005
- Thanked 36 Times in 35 Posts
one method would be to store saved configs in a database table, along with a unique id, and use that id as the request-parameter, performing a lookup on the database to pull out the values.
Another method would be to compress the key-value pairs in some way that makes them shorter, but in such a way to can reverse the compression when re-populating the form. Rather than:
(taking just the first bit)
you could get your code to output this as
or even more simply
and have your code know that a = version (and so on).
this could be shortened a litle bit further as:
and your code would split the param on |, and know that the first one is the version, the second the power (and so on).