Example #1
0
        /// <summary>
        /// Reads the Content of a Page.
        /// </summary>
        /// <param name="pageInfo">The Page.</param>
        /// <param name="cached">Specifies whether the page has to be cached or not.</param>
        /// <returns>The Page Content.</returns>
        public static PageContent GetPageContent(PageInfo pageInfo, bool cached)
        {
            PageContent result = Cache.GetPageContent(pageInfo);

            if (result == null)
            {
                result = pageInfo.Provider.GetContent(pageInfo);
                if (result != null && !result.IsEmpty())
                {
                    if (cached && !pageInfo.NonCached && !Settings.DisableCache)
                    {
                        Cache.SetPageContent(pageInfo, result);
                    }
                }
            }

            // result should NEVER be null
            if (result == null)
            {
                Log.LogEntry("PageContent could not be retrieved for page " + pageInfo.FullName + " - returning empty", EntryType.Error, Log.SystemUsername);
                result = PageContent.GetEmpty(pageInfo);
            }

            return(result);
        }