How to input lua variables to an html page?

I know I can use html attachments with email in corona. But what if I would have a bunch of variables, strings etc an would like to insert them to an html file, how do I do that?

I’m learning sqlite with corona now and I was just thinking, what if I have a bunch of textfields etc in an app for taking notes or whatever I write in those fields. Then save to sqlite (I know how to do that) and then query the database for my previous input and input those values in a nice html page.

So if I have, row.name, row.phone, row.date, row.notes etc

How do I get those values into an html page?
Hope it wasn’t a too blurry question… :slight_smile:
[import]uid: 65840 topic_id: 35755 reply_id: 335755[/import]

Basically you build up a string that has all of your HTML text in it and then write a file out to your system.TemporaryDirectory and use file:write( ). Then you can read that HTML file back in as necessary.

HTML is not white space sensitive, so you don’t have to worry too much about the formatting of the text as long as the markup is good.
[import]uid: 199310 topic_id: 35755 reply_id: 142218[/import]

Well, I’ve just done some very basic html but if it wasn’t harder than that then I’ll give it a shot.

Thanks for the quick reply
C.
[import]uid: 65840 topic_id: 35755 reply_id: 142223[/import]

Just another question, just read a little about html and css.

Should I include my css inside the html or use external css file?

[import]uid: 65840 topic_id: 35755 reply_id: 142239[/import]

Since you are talking about an email, you will either have to host the CSS on some webserver or you will have to include it inside of <style> tags in your HTML. There is no way to attach an external CSS file with the email.
[import]uid: 199310 topic_id: 35755 reply_id: 142242[/import]

Thanks, just another question…

I would like it to be viewable on iOS devices but if I would email it and the user would like to print it as an A4 page how do I set that up in my meta?

I found this on apple but it’s for devices…

[code]

[/code] [import]uid: 65840 topic\_id: 35755 reply\_id: 142247[/import]

Hopefully someone else can help with that. Or lookup how to specify different styles for print vs display (media=“print” I think)
[import]uid: 199310 topic_id: 35755 reply_id: 142249[/import]

Ran into another issue…argh

How do I deal with all the “” insde the html, I guess corona wants me to concatenate because it throws errors…

[code]
local htmlString = "

[html]

I’m learning every single day but sometimes I really feel like a monkey!!

Hello my fellow developers, I’m trying stylish html from Corona!!!

Let me tell you, in plain English, when you need to do something easy it’s not always that easy as it looks.

Hello World.

This is just the tip of the iceberg of what Corona can do.

Example

[/html]
" – end
[/code] [import]uid: 65840 topic_id: 35755 reply_id: 142250[/import]

Enclose your html with [[]] instead of " ".

[code]
local htmlString = [[

[html]

I’m learning every single day but sometimes I really feel like a monkey!!

Hello my fellow developers, I’m trying stylish html from Corona!!!

Let me tell you, in plain English, when you need to do something easy it’s not always that easy as it looks.

Hello World.

This is just the tip of the iceberg of what Corona can do.

Example

[/html]
]]
[/code] [import]uid: 13560 topic_id: 35755 reply_id: 142253[/import]

Basically you build up a string that has all of your HTML text in it and then write a file out to your system.TemporaryDirectory and use file:write( ). Then you can read that HTML file back in as necessary.

HTML is not white space sensitive, so you don’t have to worry too much about the formatting of the text as long as the markup is good.
[import]uid: 199310 topic_id: 35755 reply_id: 142218[/import]

Well, I’ve just done some very basic html but if it wasn’t harder than that then I’ll give it a shot.

Thanks for the quick reply
C.
[import]uid: 65840 topic_id: 35755 reply_id: 142223[/import]

Just another question, just read a little about html and css.

Should I include my css inside the html or use external css file?

[import]uid: 65840 topic_id: 35755 reply_id: 142239[/import]

Since you are talking about an email, you will either have to host the CSS on some webserver or you will have to include it inside of <style> tags in your HTML. There is no way to attach an external CSS file with the email.
[import]uid: 199310 topic_id: 35755 reply_id: 142242[/import]

Thanks, just another question…

I would like it to be viewable on iOS devices but if I would email it and the user would like to print it as an A4 page how do I set that up in my meta?

I found this on apple but it’s for devices…

[code]

[/code] [import]uid: 65840 topic\_id: 35755 reply\_id: 142247[/import]

Hopefully someone else can help with that. Or lookup how to specify different styles for print vs display (media=“print” I think)
[import]uid: 199310 topic_id: 35755 reply_id: 142249[/import]

Ran into another issue…argh

How do I deal with all the “” insde the html, I guess corona wants me to concatenate because it throws errors…

[code]
local htmlString = "

[html]

I’m learning every single day but sometimes I really feel like a monkey!!

Hello my fellow developers, I’m trying stylish html from Corona!!!

Let me tell you, in plain English, when you need to do something easy it’s not always that easy as it looks.

Hello World.

This is just the tip of the iceberg of what Corona can do.

Example

[/html]
" – end
[/code] [import]uid: 65840 topic_id: 35755 reply_id: 142250[/import]

Enclose your html with [[]] instead of " ".

[code]
local htmlString = [[

[html]

I’m learning every single day but sometimes I really feel like a monkey!!

Hello my fellow developers, I’m trying stylish html from Corona!!!

Let me tell you, in plain English, when you need to do something easy it’s not always that easy as it looks.

Hello World.

This is just the tip of the iceberg of what Corona can do.

Example

[/html]
]]
[/code] [import]uid: 13560 topic_id: 35755 reply_id: 142253[/import]