Discussion Forums  >  WebViews and HTML for Mobile

Replies: 6    Views: 139

JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
06/11/13 12:52 AM (10 years ago)

HTML Home Screen calling a database - how to implement it?

Hello all. This maybe better posted in somewhere like stack overflow, but I love the ease of approach of our members - so here goes! I'm wanting to build a dynamic home screen. One that has the following: A media carousel at the top (displaying images, videos) that link to said image, video or elsewhere within the app. A series of smaller carousels beneath this that do something similar. Maybe some text fields that update dynamically. There's an outline wireframe of roughly what I want to do here: https://docs.google.com/file/d/0B1Xl52Exsg9yY3RNSWJWWVpkMlU/edit?usp=sharing Now, I understand that this will have to call back to a database (so I'm learning how to build a database). For example, in a particular field of the database will be the newest image that I would like to display in the top carousel, etc. etc. My feeling is to go for a tabbed layout where the home screen is a HTML doc where the code is held within the project (I want to deploy on both iOS and Android, but I know iOS nomenclature a little better - so I'll stick to that). So the home screen HTML would be in the app's bundle rather than on a server. My question is this… How do I get the HTML to pull data from the database? For example, if I had an image link (a URL) can this simply be replaced with some kind of call to the database or do I require a PHP script? Or do I need to be generating some kind of JSON data and feed this into a screen? I fully expect to be told to go away and do my database homework but, if anyone has experience, pointers or examples I'd be most grateful.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
06/11/13 06:37 AM (10 years ago)
JimmySaver, First, I think the concept sounds neat! I wasn't able to view your sketch - said I didn't have permission. Maybe try Dropbox? I'm not sure I understand why your HTML needs db access, but perhaps that's bc I haven't seem the sketch. Are you sure HTML is the way to go? Can you use native objects for everything instead? If so, you can probably skip creating your own db and just link it to the BT control panel.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/11/13 07:09 AM (10 years ago)
I can't view it either; same thing. I agree with chris re: skip the DB and just link it to the control panel. You can always have multiple sets of child item files for different menus on the same screens. It will take a little doing, but not a *whole* lot. And I think it's kind of a neat idea as well. Cheers! -- Smug
 
JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
like
06/11/13 07:11 AM (10 years ago)
Hi Chris, Thanks for the post! The sketch - as it happens - is probably useless. The reasoning behind HTML rather than native was the need for only a single build. I thought I can build one screen for iPhone, amend for iPad and call the screen depending on the device. Similarly, I could use the same code on the Android version. I think, to surmise my task in a nutshell, I'd like to display one image in a HTML file from a database. Then I can repeat this. I'm sure I'll get there in the end!
 
JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
like
06/11/13 07:12 AM (10 years ago)
Cheers Smug. So, if I were to go for native objects, would I be using the plugin for this or doing it from scratch? (Full disclosure, I don't know how to add native objects to a screen!)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
06/11/13 08:46 AM (10 years ago)
If you did want to pull images (or any other data from a database) using the HTML screen, you would need a php script or something similar on the back end. In your HTML file, the button on the screen would be pushed and send a request to the script on the server, which would then send the results back to the app and display them on an HTML page. It's actually pretty easy to retrieve something from a database that way...there are tons of tutorials online showing how. Mark
 
JimmySaver
Aspiring developer
Profile
Posts: 187
Reg: Apr 09, 2012
location unknow...
5,870
like
06/11/13 08:56 AM (10 years ago)
Cheers Mark - will have a dig around.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.