-->
Page 1 of 1

Advice on string handeling for complex(ish) web server?

PostPosted: Thu May 28, 2015 5:33 pm
by andrew melvin
I've done a fair bit of reading but not sure how best to proceed.

I currently have several web pages being served on the esp. I have defined a string httpbuf and for each page I just += it adding line by line and then send it out at the end in each function. It's a global variable. At multiple points when constructing it I add in variables, fields etc to make the webpage...

My question is, does this consume a lot of my heap by having strings defined? Is there a better way, for example using the F macro...

I'm not sure at all how to implement that in a way that allows me to substitute in various variables and readings. Eg using sprinf (which I've also never used)
(My experience in programming started with this IDE, so I'm a big novice!)

Any help appreciated.

Andrew

Re: Advice on string handeling for complex(ish) web server?

PostPosted: Fri May 29, 2015 1:55 am
by cal
Moin,

I would look at one of the httpd server projects for esp8266 especially for "templates".

€ 0,02

Cal