More in this section

Forums / Developing with Sitefinity / Blog Development Help

Blog Development Help

5 posts, 1 answered
  1. Qainan
    Qainan avatar
    24 posts
    Registered:
    25 Oct 2011
    10 Nov 2011
    Link to this post
    Hi,

    I am look urgent help in Blog Development. I have create BlogSummary custom field. Now that field I want to display in my blog detail page via custom control.

    I have linked blog with page as a blog detail. Please anyone can help how can develop that custom control which can show BlogSummary in detail page.

    Regards,
    qainanidris.com
  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    11 Nov 2011
    Link to this post
    Hi Qainan,

    There is already a 'summary' field available inside a blogpost? Or are you talking about a custom field for a Blog instead of a Post?

    Regards,
    Daniel
  3. Qainan
    Qainan avatar
    24 posts
    Registered:
    25 Oct 2011
    13 Nov 2011
    Link to this post
    Dear Daniel,

    Thankyou very much for your tips,  Yes I am using that Summary field now. Now I am looking for one custom field which is Header Image for each blog so for that I want to create custom field and custom control so based on each blog, custom control should render only that image.

    Regards,
    QainanIdris.com
  4. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    14 Nov 2011
    Link to this post
    Hi Qainan,

    First: I want to be sure that you are talking about a 'Blog post' or a 'Blog'?

    Second: if you want a header image above each blogpost, you can use e.g. an image selector. With help of support, I've created an Image Selector and a Page Selector.

    Click here to download this project as reference

    To add an image selector to your blogposts, do the following:

    1. Add a reference to the new project
    2. Add the following code to your global.asax:

    protected void Application_Start(object sender, EventArgs e)
            {
                Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
            }
     
    protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
            {
                Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<SimpleImageSelectorDialog>();
                Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<PageSelectorDialog>();
                this.InstallCustomVirtualPaths();
     
            }
     
    private void InstallCustomVirtualPaths() {
                ConfigManager manager = ConfigManager.GetManager();
                var virtualPathConfig = manager.GetSection<VirtualPathSettingsConfig>();
                ConfigManager.Executed += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(ConfigManager_Executed);
                var thumbnailSelectorVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths) {
                    VirtualPath = "~/ThumbnailSelector/*",
                    ResolverName = "EmbeddedResourceResolver",
                    ResourceLocation = "Damar.Widgets.Selectors"
                };
                if (!virtualPathConfig.VirtualPaths.ContainsKey("~/ThumbnailSelector/*")) {
                    virtualPathConfig.VirtualPaths.Add(thumbnailSelectorVirtualPathConfig);
                    manager.SaveSection(virtualPathConfig);
                }
            }
     
    private void ConfigManager_Executed(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)
            {
                if (args.CommandName == "SaveSection")
                {
                    var section = args.CommandArguments as VirtualPathSettingsConfig;
                    if (section != null)
                    {
                        // Reset the Virtual path manager, whenever the section of the VirtualPathSettingsConfig is saved.
                        // This is needed so that the prefixes for templates in our module assembly are taken into account.
                        VirtualPathManager.Reset();
                    }
                }
            }

    3. Edit the 'App_Data\Sitefinity\Configuration\VirtualPathSettingsConfig.config:

    <?xml version="1.0" encoding="utf-8"?>
    <virtualPathSettingsConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="4.3.1873.0">
        <virtualPaths>
            <add resourceLocation="Damar.Widgets.Selectors" resolverName="EmbeddedResourceResolver" virtualPath="~/ThumbnailSelector/*" />
            <add resourceLocation="Damar.Widgets.Selectors" resolverName="EmbeddedResourceResolver" virtualPath="~/Ctrls/*" />
        </virtualPaths>
    </virtualPathSettingsConfig>

    4. Rebuild and restart your application
    5. Add a new custom field to your blog.

    Type: ShortText
    Name: HeaderImage
    Interface: Custom
    Custom type: Damar.Widgets.Selectors.SimpleImageField

    Now you can select an image to your blogpost. (see screenshot)

    Regards,
    Daniel
    Answered
  5. Qainan
    Qainan avatar
    24 posts
    Registered:
    25 Oct 2011
    16 Nov 2011
    Link to this post
    Hi Daniel,

    Thank you very much dude. I am looking for one more help in comment section. I want  that I want to customize,

    comments text and comments component.

    Regards,
    qainanidris.com

5 posts, 1 answered