Go to previous topic
Go to next topic
Last Post 06 Oct 2016 10:15 PM by  Pengtsen R
add videos to sitemap provider
 1 Replies
Author Messages


New Member


Posts:18
New Member


--
16 Sep 2016 02:15 AM
    For add videos to dnn sitemap providers add this class

    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Entities.Modules;
    using DotNetNuke.Entities.Portals;
    using DotNetNuke.Services.Sitemap;
    using System;
    using System.Collections;
    using System.Collections.Generic;

    namespace BizModules.UltraVideoGallery
    {
    public class SiteMapProvider : SitemapProvider
    {
    private Dictionary<int, float> _modulePriority = new Dictionary<int, float>();
    private Dictionary<int, int> _modulePriorityFieldId = new Dictionary<int, int>();
    private Dictionary<int, int> _viewpage = new Dictionary<int, int>();

    private SitemapUrl GetBlogUrl(int portalId, VideoInfo videoInfo)
    {
    if (!this._modulePriority.ContainsKey(videoInfo.ItemId))
    {
    this._modulePriority.Add(videoInfo.ItemId, 0.5f);
    this._modulePriorityFieldId.Add(videoInfo.ItemId, -1);
    }
    float num = this._modulePriority[videoInfo.ItemId];
    int objField = this._modulePriorityFieldId[videoInfo.ItemId];
    return new SitemapUrl { Url = videoInfo.PlayUrl, Priority = num, LastModified = videoInfo.LastModifiedDate, ChangeFrequency = SitemapChangeFrequency.Weekly };
    }

    public override List<SitemapUrl> GetUrls(int portalId, PortalSettings ps, string version)
    {
    List<SitemapUrl> tours = new List<SitemapUrl>();
    VideoController videoController = new VideoController();

    string name = Enum.GetName(typeof (VideoOrderType), VideoOrderType.AlphabeticalOrder);

    foreach (VideoInfo videoInfo in VideoController.SearchPlus(portalId, -1, "", "", name))
    {
    SitemapUrl blogUrl = this.GetBlogUrl(portalId, videoInfo);
    tours.Add(blogUrl);
    }
    return tours;
    }
    }



    and add this to manifest file in install pack

    <component type="Config">
    <config>
    <configFile>web.config</configFile>
    <install>
    <configuration>
    <nodes>
    <node path="/configuration/dotnetnuke/sitemap/providers" action="update" key="name" collision="overwrite">
    <add name="UltraVideoGallerySitemapProvider" type="BizModules.UltraVideoGallery.SiteMapProvider, BizModules.UltraVideoGallery"
    providerPath="~\desktopmodules\UltraVideoGallery\Components\" />
    </node>
    </nodes>
    </configuration>
    </install>
    <uninstall>
    <configuration>
    <nodes>
    <node path="/configuration/dotnetnuke/sitemap/providers/add[@name='UltraVideoGallerySitemapProvider']" action="remove" />
    </nodes>
    </configuration>
    </uninstall>
    </config>
    </component>


    Basic Member


    Posts:189
    Basic Member


    --
    06 Oct 2016 10:15 PM
    can you email me the final install pack with these extensions?


    ---