News Archive

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 年 前
How would I create a page for a news archive. News is working fine on the home page, but I cannot see anything for a 'news archive' setting?

I can create a page, but what code would I put in it to bring out all of the news items?

Or is there a setting for this.....pretty new to NopCommerce so might be being a muppet.
14 年 前
i created a newspage called newspage.aspx with the following  content

============================

<%@ Page Language="C#" MasterPageFile="~/MasterPages/TwoColumn.master" AutoEventWireup="true"
    Inherits="NopSolutions.NopCommerce.Web.NewsPage2" Codebehind="NewsPage.aspx.cs" %>

<%@ Register TagPrefix="nopCommerce" TagName="NewsList" Src="~/Modules/NewsList.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="Server">
    <nopCommerce:NewsList ID="ctrlNewsList" runat="server" />
</asp:Content>

=============================
the codebehind was as follows


using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Text;
using System.Web;
using System.Web.Caching;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using NopSolutions.NopCommerce.BusinessLogic;
using NopSolutions.NopCommerce.BusinessLogic.Localization;
using NopSolutions.NopCommerce.BusinessLogic.Payment;
using NopSolutions.NopCommerce.BusinessLogic.SEO;
using NopSolutions.NopCommerce.Common.Utils;

namespace NopSolutions.NopCommerce.Web
{
    public partial class NewsPage2 : BaseNopPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CommonHelper.EnsureNonSSL();
            }

            string title = GetLocaleResourceString("PageTitle.News");
            SEOHelper.RenderTitle(this, title, true);

        }
    }
}




=================================
i created a new resource sting called     PageTitle.News
and created a new link to it in headermenu.ascx

I didn't remove the control from the default page, just chose admin option not to show news on home page

only thing with this is that the news items  will not be paged so if you have a lot, the page (and load times) could be very large


remember to recompile using  VS


EDIT
i submitted a feature request for this on codeplex - go and vote for it !
14 年 前
Thanks, I will be going to vote for it definately! Makes a lot of sense. We have a lot of news so I think I will play with it and see if I can get it to page for me. Thanks for the starting point though

Simon
14 年 前
Thanks for the codes.

That's help up a lot.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.