Forum Discussion
Hi Vikas,
Thanks for your reply!,
I have created two custom components:
<component id="common.widget.custom-content" name="13"/>
<component id="common.widget.custom-content" name="14"/>
13-Managers and 14- Users.
If Managers logged-in then, the both custom components should be visible and If user's logged-in then only one user's component should be visible.
I want to restrict 13- (custom component) for users? How can I do this?
I tried to add your code in wrapper--> Page head top content.
<#if !user.anonymous>
<component id="common.widget.custom-content" name="13"/>
</#if>
The above given code is not working.
And please provide me a clear code.
Thanks,
Sateesh.
Hi sateesh999
To call a component from another component, you'll need something like this using the @component FreeMarker directive
<#if !user.anonymous>
<@component id="common.widget.custom-content" name="13"/>
</#if>
The @component directive also takes parameters, which you could pass to and use in the custom component you're calling.
Other helpful directives might be @override and @delegate.
Here are a few dev guides to take a look at:
Pass parameters to a custom component