Ricardo Roque
Posts: 0
Joined: Tue Nov 26, 2013 11:22 am

Loading Files Manually Created in WEB_RESOURCES.

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Loading Files Manually Created in WEB_RESOURCES.

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.

Ricardo Roque
Posts: 0
Joined: Tue Nov 26, 2013 11:22 am

Loading Files Manually Created in WEB_RESOURCES.

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.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Loading Files Manually Created in WEB_RESOURCES.

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.

Ricardo Roque
Posts: 0
Joined: Tue Nov 26, 2013 11:22 am

Loading Files Manually Created in WEB_RESOURCES.

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Loading Files Manually Created in WEB_RESOURCES.

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.

Return to “Issues”