Forum Discussion

EmilyBilling's avatar
9 years ago

Dynamically loading profile picture, name and title into custom component

Hi, I have a people carousel containing the profile photo (user avatar), first/last name and Title of staff members where I want to dynamically load the staff members’ details (avatar, name, title) from their profile. How is it possible to reference these dynamically in my html?

 

<!-- people Item -->

        <div class=" people-item"> <a href="/t5/user/viewprofilepage/user-id/53">

          <div class="people-icon"> <img src="dynamically-load-user-avatar-here"/> </div>

          <div class=" people-title"> dynamically-load-user-name-here </div>

          <div class=" people-descr"> dynamically-load-user-role-title-here </div>

          </a> </div>

<!-- End people Item -->

  • PaoloT's avatar
    PaoloT
    Lithium Alumni (Retired)

    Hi EmilyBilling

     

    it looks like you have a static HTML snippet and you want to change it to be dynamic. I think creating a Studio Custom Component is the best way to do this. It will however require writing some logic with Freemarker and use the Lithium REST APIs to retrieve the information. You might want, for example, to load users that have a certain Role (staff role or similar). Have you seen our API documentation portal already?

     

    Kind Regards,