How to display image in mod_cbcontent?

2 years 2 months ago #327744 by liaskas
Hello

Need to display an image according to the usergroup each user belongs to.

Is it possible?

I try like this but the image does not show. Can you please advise?


[cb:if usergroup includes "2"]<p><img scr="/images/icon.png"> Text here</p>[/cb:if]

Thank you.

Please Log in to join the conversation.

2 years 2 months ago - 2 years 2 months ago #327757 by krileon
Replied by krileon on topic How to display image in mod_cbcontent?
Yes that's possible. Your usage should work perfectly fine or at least "Text here" should be displaying; can't speak for the image as the path might be wrong.

Be sure to replace the 2 with the usergroup id you want to check against. Default Joomla registered usergroup id is 2 so that should work for any user with the Registered usergroup. This also works with view access levels as shown below.

Usergroups:
[cb:if usergroup includes "2"]I have Registered Usergroup[/cb:if]

View Access Levels:
[cb:if viewaccesslevel includes "1"]I am Public[/cb:if]

Try both of the above and see if they output their text. As for your image it may just be a pathing problem. Be sure the path to your image file in src is correct. It's worth noting we don't do anything special here. We simply take what you've supplied, run it through substitutions, and output it. So nothing beyond normal valid HTML is necessary.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.181 seconds

Facebook Twitter LinkedIn