Discussion Forums  >  WebViews and HTML for Mobile

Replies: 8    Views: 319

S-George
Apple Fan
Profile
Posts: 111
Reg: Jan 18, 2012
location unknow...
4,460
05/27/15 07:56 AM (9 years ago)

Can we have images in subfolders in BT_docs on excode?

Can we have images in subfolders in BT_docs on excode? e.g: BT_docs/my_images/image.png These images will be linked in HTML files that are located in BT_docs. I try like the example above and the images will not show. Is there any other way to have subfolders so I can have my images in order. When I have my images in BT_docs folder thy do show.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
05/27/15 08:01 AM (9 years ago)
What I will typically do is copy all of the images into the BT_docs folder, and within Xcode, create a group that separates them. Just drop them in your project, while they're still grouped together, select them all, and choose 'create group from selection' and call it 'images' or whatever... But in your HTML, you'll reference them at the same level as the html page in the BT_docs directory... that grouping is merely symbolic, and 'for appearances' only. Not to be used in a file path. Cheers! -- Smug
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/27/15 01:17 PM (9 years ago)
I use subfolders for my html, in both ios (xcode) or android, so it can work. The reason I do it is I like to get all my html links to work outside xcode with relative paths and then drag the whole lot into BT_Docs. To reference the images from your html with a relative path, do not use BT_Docs in the link. So in your example I think it will either be /my_images/image.png or ../my_images/image.png Alan
 
S-George
Apple Fan
Profile
Posts: 111
Reg: Jan 18, 2012
location unknow...
4,460
like
05/28/15 06:51 AM (9 years ago)
Hi AlanMac It dos not wok for me, i have try "/my_images/image.png or ../my_images/image.png , ./my_images/image.png" With the links above thy do show in the browser out of excode. The olny way the images are showing for ios is if i have the html and the images in the BT_Docs folder and link like this "/image.png"
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/28/15 06:57 AM (9 years ago)
Which plugin are you using to display your html? I use the HTML Pro plugin. It might be that, or it might be how you drag the sub-folders in (i.e. the options you tick). When you copy files into an xcode project, a box pops up to choose options for adding the files. Drag your html file into the root of BT_Docs, tick 'Create groups for any added folders'. Separately, drag in the folder with the images, tick 'Create folder references for any added folders'.
 
S-George
Apple Fan
Profile
Posts: 111
Reg: Jan 18, 2012
location unknow...
4,460
like
05/28/15 09:29 AM (9 years ago)
AlanMac After folowing your steps "Drag your html file into the root of BT_Docs, tick 'Create groups for any added folders'. Separately, drag in the folder with the images, tick 'Create folder references for any added folders" This works now i can have subfolders for my images and subfolder for css and js in ios.. Thank you very much.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/28/15 11:03 AM (9 years ago)
You are very welcome. PS - do it this way and your html will work in android too. Cheers, Alan
 
amysus
Lost but trying
Profile
Posts: 90
Reg: Oct 28, 2011
traveling the w...
3,650
like
05/31/16 07:06 AM (8 years ago)
S-George, did you have to switch to HTML Pro plugin to get this to work? Also, AlanMac, do you think this will work with everything, that is, other types of files (CSS, Scripts, Audio)? If so, where would they go (sorry I was uncertain from above post) - e.g., would the audio files go into the BT_Audio folder or into he BT_Docs folder? What about the scripts and css? I know nothing ... so please go from there :-) Amy
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/31/16 07:47 AM (8 years ago)
Hi Amy, short answer is yes it will work if you put everything into BT_Docs. 9 times out of 10 the problems people have with html in Buzztouch is to do with the links between the html , css, JavaScript etc. So I always think of this method as the safe option, because you can test all the links in a std browser, works for android and iOS and works on the internet. The BT_Audio, BT_Video BT_Images etc folders are meant primarily for plugins. It may be that your html can find files if you put them there too (without specifying paths) I have read others do this but Inot tried. I prefer the above BT_Docs method. The only issue I have ever had with using html in Buzztouch is that html pro plugin has some issues with relative folder paths - these would be for paths on the internet, not local files. The work-around for this is to use absolute paths, not relative. Hope that all helps, Alan
 

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.