Display Blog Post Using Custom Control Widget

Posted by Community Admin on 04-Aug-2018 21:16

Display Blog Post Using Custom Control Widget

All Replies

Posted by Community Admin on 17-Apr-2013 00:00

Firstly I am a NOOB using Sitefinity.

For the site I am working on we want to develop our own layout for blog posts using a Custom Control Widget.

So far I have:

1. Created a template which points to a master page. The master page has one contentplaceholder on it.
2. Created a page which uses the above template and I can drag my custom control onto the page within the widget area.

However when I publish the page and try to browse a blog post I simply get a blank page.

The intersting thing that is if I drag the Blog Posts widget onto the page as well I then get the post listed twice - once from the Blog Posts widget, and once from my custom control.

The initial part of my code behind file is below:

string url = Request.RawUrl.ToString();

            int lastSlash = url.LastIndexOf("/");

            if (url.LastIndexOf("/") > 0)
                url = url.Substring(url.LastIndexOf("/") + 1);

            Post post = svc.GetPost(url); //custom method to return post data ...

Is anyone able to enlighten as to what I need to do to get my page working ?

Thanks, Nigel

Posted by Community Admin on 17-Apr-2013 00:00

OK - as is often the case a bit more perserverance has somewhat progressed my issue.

I have now removed my custom control from the page and using Using external widget template file as a reference I have managed to get a page displaying albiet without any blog post information being displayed from the user control.

So my question now is what is the best way to develop a custom layout ? One key consideration is that we have some custom functionality that extracts all images from the blog post content and displays in a separate column on the page. There is also functionality to modify the content to remove the images and just leave the content.

Thanks, Nigel

This thread is closed