I have a html code that shows the sporting fixtures relevant to specific teams in my database and I need it to change depending on the selected team. This is an example of the html code I have for one division (I have different codes for the different team divisions: <iframe width=500 height=315 src=https://tournament-cloud.com/#T?x=7584&FS=Stage&Embed=true frameborder=0 allowfullscreen></iframe> This is my website: https://editor.wix.com/html/editor/web/renderer/edit/4ac7b5ae-d42a-4469-8158-3fdef1bed0f5?metaSiteId=9d3bfe20-e1ee-4eb6-8cdc-53a220563dab&editorSessionId=E056428C-8ABD-4596-B101-6FD4EE07E8E4 I've put the html code boxes in this page to demonstrate what I would love it to show but as they aren't able to be "connected to data" I don't know how to link it up!
top of page
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
![feature fixed.png](https://static.wixstatic.com/media/3bfa8a_f845e1016b8a49758acdd6edd6610c3b~mv2.png/v1/crop/x_0,y_2,w_852,h_508/fill/w_104,h_62,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/feature%20fixed.png)
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
bottom of page
Hi
I have a HTML code as
<!-- LikeBtn.com BEGIN --> <span class="likebtn-wrapper" data-theme="custom" data-btn_size="45" data-f_size="25" data-icon_size="35" data-icon_l="arr7-u" data-icon_d="arr7-d" data-icon_l_c_v="#16a200" data-icon_d_c_v="#ac0303" data-white_label="true" data-identifier="Robert Downey" data-show_like_label="false" data-counter_frmt="comma" data-counter_padding="10" data-counter_zero_show="true" data-tooltip_enabled="false"></span> <script>(function(d,e,s){if(d.getElementById("likebtn_wjs"))return;a=d.createElement(e);m=d.getElementsByTagName(e)[0];a.async=1;a.id="likebtn_wjs";a.src=s;m.parentNode.insertBefore(a, m)})(document,"script","//w.likebtn.com/js/w/widget.js");</script> <!-- LikeBtn.com END -->
I just want to change the data-identifier text (which here is Robert Downey) of the html element which is at dynamic page of my wixsite as my code differ only at data-identifier. and i want to connect this text inside the data identifier component with my database with field named as "Name". Please tell me how could i do this. I need your help.
What you're looking for (I think) is that you want to use the result of a database query to set the link. It might look something like this:
let division = < value from selected table row > wixData.query("teams") .eq("division", division) .find() .then( (results) => { let items = results.items; let item = items[0]; $w("#html1").src = item.link; } ) .catch( (err) => { let errorMsg = err; } );
This is not complete working or tested code, but rather gives you an idea of what you need to do with the HtmlComponent. What you want should be doable. It just depends on what you envision as acceptable.
In order to accomplish what you're trying to do you'll need some proficiency in code. We're here to help when you run into difficulties.
Good luck,
Yisrael
Hi Yisrael,
Thanks for the response!
I don't quite understand? I don't really know much about coding but I am trying to learn as much as I can as I go.
^ This is my database and I want to create dynamic item page for the different divisions but as each dynamic page requires an embedded html code I am lost.
I want to add the html code into a column in this database and link it to an element on the dynamic page, I just don't know what element will let it work?
Not sure if what i'm saying makes sense or not?
Thanks
Hi Imogen,
Welcome to the Wix Code forums.
If I understand correctly what you want, each team has a different URL which is used in the HTML code.
The HtmlComponent is used in two different ways:
Set the link src to embed an external site/doc/whatever on your page. You could do something like this:
$w("#html1").src = "https://tournament-cloud.com/#T?x=7584&FS=Stage&Embed=true";
(I tried this myself on an experimental page and it worked fine.)
Or, embed code in the HtmlComponent and pass messages back and forth between the page and the HtmlComponent code. Read the article Working with the HTML Component in Wix Code for details on how this is done.
Good luck,
Yisrael