構成ファイルを使用してデータ エクステンダーを構成可能にしたいと考えています。エディター構成ファイルに「customconfiguration」というノードがあることがわかりました。これは、拡張機能の動作を構成するために使用できると思います。C# からその customconfiguration ノードにアクセスする方法はありますか?
質問する
150 次
2 に答える
4
データエクステンダーに適用されるかどうかはわかりませんが、次のコードを使用してモデル構成からカスタム構成を読み取ります。
using System.Xml;
using Tridion.Web.UI;
using Tridion.Web.UI.Core;
namespace Custom.Model
{
public class Configuration
{
public static string GetConfigString(string configItem) {
XmlDocument customConfiguration = ConfigurationManager.Models["Custom.Model"].CustomXml;
XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
ns.AddNamespace("c", Constants.EDITOR_CONFIG_NAMESPACE);
XmlNode node = customConfiguration.SelectSingleNode("//c:customconfiguration/c:clientconfiguration/c:" + configItem, ns);
string configValue = node != null ? node.InnerText : "";
return configValue;
}
}
}
ConfigurationManager.Models を使用する代わりに、ConfigurationManager.Editors を使用してエディター構成にアクセスできます。拡張機能を有効にする System.config で指定された名前でモデルまたはエディターを参照します。たとえば、以下の例で定義されている CME です。
<editor name="CME">
<installpath>C:\Program Files (x86)\Tridion\web\WebUI\Editors\CME\</installpath>
<configuration>Configuration\CME.config</configuration>
<vdir>CME</vdir>
</editor>
于 2012-10-11T11:35:53.433 に答える
2
WebRoot/Configuration フォルダー内の構成ファイルは、CME アプリケーションの一般的な構成ファイルである "Core" 構成ファイルです。それに加えて、CME アプリケーションには各エディターとモデルの構成ファイルがあります。これらの構成ファイルには、ConfigurationManager からアクセスできる「customconfiguration」セクションがあります。
DataExtenderr を作成するときは、新しい拡張モデルを作成する必要があります。そして、そのモデルの構成ファイル。カスタム構成セクションに必要な情報を入力できます。
于 2012-10-11T12:21:45.383 に答える