From my response, my image item as no type and i need it to convert element in HTML depending of the type


That's the response i get for the image item

Hi @augustin.v71100,

Thanks for reaching out about this. If I understand you correctly, you want to parse the JSON for each document from top to bottom and display each field it finds in that order.

Unfortunately this isn't how we recommend using Prismic. We recommend creating your Custom Types and mapping each field to a specific layout that you have.

Or in your case, we recommend using our Slices feature. This will allow you to build a page using pre-defined content blocks. You can learn more about Slices here:

Let me know if you have any other questions about this or anything else :slight_smile:

Cheers,
Levi

So I need to make slices the from those slices i make a function for each slices that convert it into html element ? I don't find a lot on how to use prismic for developper.

I would use it for article, so it's limited to titles, paragraphs, lists, image, videos and that's all, ands the form is very simple.

What i don't really understand is how to convert properly the response from prismic API into html on my page ?

Thanks for your response

The Templating section of our PHP documentation explains how you can convert the JSON response to HTML on your page.

The Templating section also includes a page for each field type and explains how to convert it to HTML for you.

Let me know if you have any more questions about this :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.