var cacheKey = "mydata"; // unique key for the cached data var cachedData = DotNetNuke.Common.Globals.GetCache(cacheKey); // try to get cached data if (cachedData == null) // data is not in cache { cachedData = MyDataLoader.LoadData(); // load data from the database DotNetNuke.Common.Globals.SetCache(cacheKey, cachedData); // cache the data } // use the cached data foreach (var item in cachedData) { // do something with the data }
var localizedString = DotNetNuke.Common.Globals.GetString("my_key", "My default value"); // get a localized string for a key // use the localized string Console.WriteLine(localizedString);
var portalId = 1; // ID of the portal var portalHomeUrl = DotNetNuke.Common.Globals.GetPortalDomain(portalId); // get the portal home URL var siteAlias = DotNetNuke.Common.Globals.GetSiteSettings().SiteAlias; // get the site alias // use the portal home URL and site alias var fullUrl = $"{portalHomeUrl}/{siteAlias}/my-page.aspx"; Console.WriteLine(fullUrl);In summary, DotNetNuke.Common.Globals is a utility library in DotNetNuke that provides methods for caching, localization, formatting dates and times, and handling portal and site URLs. You can use these methods to improve the performance and functionality of your DotNetNuke website.