Forum Discussion

id-chalmers's avatar
11 years ago

Question involving working with components

(In regards to this article) Is there an easy way to bring in only the contents of a standard component from inside a custom component? I'm bringing the announcements component inside another custom component:

 

<@component id="common.widget.announcement" />

 

It's being brought in complete with wrapper divs and header title. I'd like to bring in just the contents. Can this be done by passing a paramerter as suggested here ?

Thanks!

 

 

  • I don't think pulling in only content from announcements is feasble but if you just want to get the announcements text, you could use a workaround, like using the Custom Content in admin and then call it inside the Custom Component in studio using rest call.

    e.g. if you're using custom content 1 in admin to store the announcements text, use following call in your costom component.

     

    <#assign cc1_text= restadmin("/settings/name/customcontent.1_text/").value>

     

    Or other workaround might be, to override the announcements component, this might help you what you're looking for.

     

    http://community.lithium.com/t5/Community-FAQs/Using-override-to-change-core-components/ta-p/61358

     

  • I don't think pulling in only content from announcements is feasble but if you just want to get the announcements text, you could use a workaround, like using the Custom Content in admin and then call it inside the Custom Component in studio using rest call.

    e.g. if you're using custom content 1 in admin to store the announcements text, use following call in your costom component.

     

    <#assign cc1_text= restadmin("/settings/name/customcontent.1_text/").value>

     

    Or other workaround might be, to override the announcements component, this might help you what you're looking for.

     

    http://community.lithium.com/t5/Community-FAQs/Using-override-to-change-core-components/ta-p/61358

     

    • id-chalmers's avatar
      id-chalmers
      Mentor

      Thanks

      Both look promising. To bad the announcements can't be treated like the 'custom content' feature. 

      I ended up just including the whole component in my custom one using the xml tag, and I used css to hide all the chrome. Smelly - I know - but it works!