How would I go about getting the path to data

Topics: General
Jul 2, 2011 at 7:26 PM

I am using the following code which works to query the news items.  I then take the title and apply it to a variable with a carriage return, then when the news variable is loaded it put it into a literal to show on the page.  In the below code how would I go about getting the path information that I would use for the link for the news article or get the whole url path to that article.

using(DataConnection connection = new DataConnection())
            var articles = from a in connection.Get<Composite.News.NewsItem>().OrderByDescending(d => d.Date).Take(7) select a;
            foreach (var news in articles)

                RecentNews = RecentNews + news.Title.ToString() + "<br />";

            litRecentNews.Text = RecentNews;

Jul 4, 2011 at 12:08 PM


If you are using Composite.News module to show recent news items it is better to use XSLT Composite.News.Latest function, where you can specify count of shown items and other parameters. Also you can modify the output of this function, just locate its code (XSLT functions-> Composite.News.Latest -> Edit )

But if you considered to write your own UserControl which will render news item links, it depends on what version of C1 and Composite.News do you use?

Jul 5, 2011 at 12:15 AM

I am using the 2.1.1 version and the reason I am doing it this way is because the news is broken out into categories.  Also there is almost 10,000 articles to import from 2009 forward that appear in 8 differnt categories.  XSLT is to slow for what it needs to do, so I have to do it in codebehind so it will render fast.  Then this also gives me the flexibility to display the top 7 new articles on the main page, then on the news page it will allow me to show the 4 most newest articles under each category heading in its own pod.  Then this will also allow me to create a category list page to list all articles in date order on each category specific page.  This will also allow me to handle newer standard articles and archive articles.  The articles on the site will only be for 365 days at a time, then once they are over 365 days I then show them in a news archive area and not in the category pods or pages......  I have found a way in the codebehind to get the pull path and have it working......