+1-888-365-2779
Try Now
More in this section

Copy News Module

4 posts, 0 answered
  1. WebGeek
    WebGeek avatar
    186 posts
    Registered:
    20 Dec 2006
    28 Feb 2007
    Link to this post
    Can you copy a module (news) and use it for another part of your sitefinity site?  Basically I like the way the news module works and I have another part of my site that the news module would work well in.  Is there a way that I can copy the module and modify it to work in this area?
  2. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    01 Mar 2007
    Link to this post
    Hi James,

    If I understand correctly, you want to have two or more news modules in the same application working independently.

    Here is what you need to setup to achieve this:

    1. Open the web.config.
    2. In the section cmsEngine from the providers collection copy the provider element named News.
    3. Paste below it and rename it to Local_News for example.
    4. Change the applicationName to “/LocalNews”.
      The new provider should look like this:

    <add name="Local_News"
        
    visible="False"
        
    applicationName="/LocalNews"
        
    allowVersioning="True"
        
    allowWorkflow="False"
        
    connectionStringName="DefaultNolicsConnection"
        
    securityProviderName=""
        
    versioningProviderName=""
        
    type="Telerik.Cms.Engine.DefaultContentProvider, Telerik.Cms.Engine"
        ......
        
    />

    1. From the metaFields collection in the cmsEngine section, copy all elements whose keys start with News.
    2. Paste them below the last element so the new ones are added to the collection.
    3. Change the key of each new element from News.[FieldName] to Local_News.[FieldName].

    <add key="Local_News.Title" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/>
    <add key="Local_News.Summary" valueType="LongText" visible="True" searchable="True" sortable="True" defaultValue=""/>
    <add key="Local_News.Author" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/>
    <add key="Local_News.Source" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue=""/>
    <add key="Local_News.Publication_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue=""/>
    <add key="Local_News.Expiration_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue=""/>
    <add key="Local_News.Thumbnail" valueType="ShortText" visible="True" searchable="False" sortable="False" defaultValue=""/>

    1. Go to News section form genericContentProviders collection, copy the first element and paste below it.
    2. Rename the provider to Local_News.
    3. Run the application.

    When you go to Modules / News, a combo box should appear in the upper left corner displaying the current provider. Select the desired provider you want to manage news for.

    When you put NewsList or SingleNews control on a page,  you need to specify the provider name for the control. If no provider is specified, the default one will be used.

    The ProviderName property is located in the Data section.

    You can also store the data in a different database by specifying different connection strings for both providers.

    Best wishes,
    Bob
    the telerik team
  3. jessenaiman
    jessenaiman avatar
    23 posts
    Registered:
    06 Feb 2007
    01 Mar 2007
    Link to this post
    How would I change the news list code to use a rotator? Is there a way to override the necessity to use a repeater?
  4. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    02 Mar 2007
    Link to this post
    Hi Jesse,

    Very nice idea indeed, we will put it in our to-do list. We will also provide a NewsListDataSource control to allow data binding for custom controls. For the time being, you can use the Content Manager to populate controls programmatically.

    Telerik.Cms.Engine.ContentManager manager = new Telerik.Cms.Engine.ContentManager("News");
    foreach (Telerik.Cms.Engine.IContent article in manager.GetContent())
    {
        
    string title = article.GetMetaData("Title") as string;
        
    string text = article.Content as string;
    }

    Best wishes,
    Bob
    the telerik team
Register for webinar
4 posts, 0 answered