Display ContenBlock by category

Posted by Community Admin on 05-Aug-2018 12:23

Display ContenBlock by category

All Replies

Posted by Community Admin on 28-Oct-2013 00:00

Hi

Can anyone help me, on how to display content blocks by category, using the Categories Widget. It's possible width images, docs. blogs and so on, but wath about content blocks??

Is there another aproach ?? :-)

Best regards
Christian

Posted by Community Admin on 31-Oct-2013 00:00

Hello,

The categories widget is not working with Content Blocks. For performance reasons we have tried minimizing the amount of data being pulled in our ContentSelectors throughout Sitefintiy. Loading all the avaialble tags and categories and filtering by them woul impose slower loading of the data in general.

If you want you could pull all content blocks filtered by specific tag/category in a custom widget programatically. For example:

var manager = ContentManager.GetManager();
    var myBlocks = manager.GetContent().Where(contBlock => contBlock.Status == ContentLifecycleStatus.Live && contBlock.GetValue<TrackedList<Guid>>("Tags").Contains(singleGuid));

where singleGuid is the ID of your tag to filter by. To use the above sample you'll need to add a using Telerik.Sitefinity.Model in your class, to be able to use the extension method GetValue<T>().

In a nutshell this would allow you to bind a filtered collection of shared content blocks to any suitable control and display the actual HTML content.

Regards,
Stefani Tacheva
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 31-Oct-2013 00:00

Hello Stefani

Thank's for your reply.

In the meantime i have tried to create a module and by the categories widget sorte by dynamic content type. That approach almost work - but how do i get the widget to display content, not only in top level categories??

Hope there is a solution for that :-)

Second question - regarding Responsive Design :

On  the default group of rules i have applyed a css file to modify the layout. But the css file overwrite the default css file and apply the mobile css styles on all devices.. Could you help on that matter to ???

Look forward to your reply :-)

Best regards Christian

This thread is closed