Unreachable files

Forums: 

Hi :)

I've been trying to create my own content type and I've ran on some issues.

1st: Lack of information. Other than "Hello world" tutorial there are no more examples (or I couldn't find any) how to use some of available functions

and other stuff. Is there any simple example or someone who is developing something at the moment so that he/she can answer my quesions?

2nd: For some reason I cannot read .json files and use their content. Some of the things I've tried is

$.getJSON("./content/content.json"....

But I get an 404 error.

Can you please explain to me how should I read data from .json files?

I think I'm slowly losing my mind.

Have a nice day, Meri

otacke's picture

Hi Meri!

There's a boilerplate template with two different branches. The master branch holds a simple example, the question type branch provides a frame for content types that are supposed to be, well, of question type :-)

Have you checked if the path that you're building and that you're trying to load from actually exists? Well, doesn't seem to be the case if you get a 404 :-) 

You should not assume any hardcoded paths to work, because H5P can be put in different folders. You can, however, e.g. use H5P.getLibraryPath as described at https://h5p.org/documentation/api/H5P.html#.getLibraryPath to access your distribution and thus json files that you ship with it.

Best,
Oliver