Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Shared resx amongst all skin filesShared resx amongst all skin files
Previous
 
Next
New Post
10/6/2011 3:44 PM
 
Is there any way to use a resx file for some site-wide text items?  For example, on a skin that I'm developing there are places for the address, phone number, and disclaimer texts and I would like to be able to put those into a resx so that I could use a Text SkinObject for displaying them.  I was able to modify the default Text SkinObject to also allow for Global resources but those apparently get overwritten whenever an upgrade is performed to DotNetNuke.  Ideally I'd like to be able to create a resx in the skins app_localresources directory that can be accessed by any of the skins files.  Is this possible?
 
New Post
10/6/2011 5:08 PM
 
I was able to make a slightly customized version of the Text SkinObject to get the effect I was looking for.  Here is the new SkinObject's code behind:
namespace DotNetNuke.UI.Skins.Controls
{
    public partial class TextPortal : SkinObjectBase
    {
        public string ShowText { get; set; }

        public string CssClass { get; set; }

        public string Source { get; set; }

        public string ResourceKey { get; set; }

        public bool ReplaceTokens { get; set; }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            string strText = ShowText;
            
            //load resources
            if (!String.IsNullOrEmpty(ResourceKey))
            {
                //localization
                string strFile = Path.GetFileName(Server.MapPath(PortalSettings.ActiveTab.SkinSrc));
                string strLocalization = "";
                strFile = PortalSettings.ActiveTab.SkinPath + Localization.LocalResourceDirectory + "/" + strFile;
                switch (Source)
                {
                    case "Global":
                        strLocalization = Localization.GetString(ResourceKey, Localization.GlobalResourceFile);
                        break;
                    case "Skin":
                        strLocalization = Localization.GetString(ResourceKey, strFile);
                        break;
                    default:
                        if (!String.IsNullOrEmpty(Source))
                        {
                            strFile = PortalSettings.ActiveTab.SkinPath + Localization.LocalResourceDirectory + "/" + Source;
                            strLocalization = Localization.GetString(ResourceKey, strFile);
                        }
                        break;

                }
                if (!String.IsNullOrEmpty(strLocalization))
                {
                    strText = strLocalization;
                }
                //strText = strFile;
            }
            
            //If no value is found then use the value set the the Text attribute
            if (string.IsNullOrEmpty(strText))
            {
                strText = ShowText;
            }
            
            //token replace
            if (ReplaceTokens)
            {
                var tr = new TokenReplace();
                tr.AccessingUser = PortalSettings.UserInfo;
                strText = tr.ReplaceEnvironmentTokens(strText);
            }
            lblText.Text = strText;
            if (!String.IsNullOrEmpty(CssClass))
            {
                lblText.CssClass = CssClass;
            }
        }
    }
}

And in the skin file I'm able to access the "SkinGlobals.resx" I created within the app_localresources for the skin by calling the SkinObject like this:

<dnn:TEXTPORTAL runat="server" id="dnnTEXTFooterPhone" CssClass=" " ShowText="" Source="SkinGlobals.resx" ResourceKey="FooterPhone" />

In addition, I've added the ability to also use the global resx for that portal as well by passing "Global" as the Source parameter.

 
New Post
10/6/2011 5:21 PM
 
Not sure if I understand your question correctly, but that's exactly what the text skin object allows you to do.
BTW, if you create a fork of an existing skin object simply install it with a different name (& in a different  folder) and it will not be overwritten on upgrade...
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Shared resx amongst all skin filesShared resx amongst all skin files


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out