Page 1 of 1

Loading Files Manually Created in WEB_RESOURCES.

Posted: Mon Jan 06, 2014 11:31 am
by Ricardo Roque

Hi,

I've created manually a file named 'files/myTemplates.html' in WEB_RESOURCES. It contains some custom templates. I used $.get to load it at runtime and worked great in the Web version but not in Android native. Do I have to copy the same file somewhere in ANDROID source files as well? Or, how do I reference a project file independently of the exported platform? Many thanks for any help.


Loading Files Manually Created in WEB_RESOURCES.

Posted: Mon Jan 06, 2014 1:41 pm
by Kateryna Grynko

Hi Ricardo,

You need to duplicate this file for each OS.

It would be better to add HTML component to page, so you can change it once.


Loading Files Manually Created in WEB_RESOURCES.

Posted: Mon Jan 06, 2014 2:06 pm
by Ricardo Roque

Hi Katya, I've tried that but I'd like to know how to do it for some other future cases, since for me it is better and more clear the way I am doing now. Also, I may need to add other types of files as well. So, in the above case where in the ANDROID folder should I copy the file? Since it didn't get found at:

ANDROID::MyApp::assets::www::files::myTemplates.html

In the app I'm using:

$.get("files/myTemplates.html"); // Works OK in the Web version

Thanks.


Loading Files Manually Created in WEB_RESOURCES.

Posted: Mon Jan 06, 2014 8:27 pm
by Maryna Brodina

Hello! I don't think it's a good idea to use relative path "files/myTemplates.html", try to use absolute one. You can retrieve it the same way as Appery.getImagePath http://docs.appery.io/javascript-api/.... Take a look how this function is implemented and create your own one, or modify path which this function returns.


Loading Files Manually Created in WEB_RESOURCES.

Posted: Tue Jan 07, 2014 5:42 pm
by Ricardo Roque

Sure. But a JQuery command like:

$.get("files/myTemplates.html");

will look where in a Android Native filesystem? I'm trying to understand the filesystem as the platform changes.

Relative paths are used several times in CSS with no problems in any exported platform.

Regards.


Loading Files Manually Created in WEB_RESOURCES.

Posted: Wed Jan 08, 2014 8:29 am
by Kateryna Grynko

Hi Ricardo,

Take a look at here please: https://groups.google.com/forum/#!top...

If you add your file to web resources directly, it will be in the same directory as an app page file.