That’s cool - we glad you learn our platform ![]()
There is a ton of documentation for Wix Code features - you are welcome to check them out. This would be a good starting point - https://www.wix.com/code/home
As for your question specifically - when you add a dynamic page, it is connected to some collection, right? So each dynamic page represents a data from a single collections row. You can access that row in the context of the page - fetch data from it, display it, etc.
This could be done using dataset - the abstraction representing the data from the collections. When you create a Dynamic Page, a default dataset is created automatically - check the dynamic page template. It looks like this:
You can write your own code (in that $w.onReady section for example) accessing the dataset - $w(‘dynamicDataset’) - and getting the current item from it. Check the API reference for more details on how to work with it.
Regarding the field type in the collection - depends on what exactly you want to store there. If it’s some HTML code - the Text type would be the correct choice.
A bit more resources for the Dynamic pages:
https://www.wix.com/code/home/dynamic-pages
A small note about posting messages to IFrame :
For now, due to asynchronous nature of loading of the IFrame component, it is possible that the code in the onReady section will run before the IFrame loaded - meaning that the message would be sent before the IFrame is able to get it (so it will be lost).
The basic workaround in this case will be to send the message after a small delay:
instead of $w(" #html2 ").postMessage(“Message from page code!”); it would be setTimeout(() => $w(" #html2 ").postMessage(“Message from page code!”), 2000).
We are looking into this to improve this experience.
Hope it helps ![]()
