简体   繁体   中英

How to call Vbscript function in the Compound template (using C#fragment) in Tridion?

请让我知道在Tridion 2011中如何在Compound模板(使用C#fragment)中调用Vbscript函数吗?

I'm pretty sure this isn't possible. You can't mix the legacy templates with Modular templates.

Sounds like you are mixing legacy style VBScript page templates with current style Compound component templates (or something similar). Mixing the two types is (sometimes) possible , but you cannot call functions in page templates from your component templates like you could with a pure VBScript setup.

You will need to re-implement your VBScript function's functionality as either a Dreamweaver template callable custom function or a .Net based Template Building Block ( C# fragment or .Net assembly ) depending on your use case.

OK - just for fun, a strictly literal answer. Please note that I do not advocate this approach.

  1. Write your function in VBScript
  2. Convert your VbScript file into a Windows Script Component
  3. Create a .NET Interop wrapper for your Windows Script component
  4. Put the thing in the GAC I should think...
  5. Call it from your C# fragment

As I said - this is a strictly literal answer to your question as stated. It's enough to say that it's technically possible to do what you are asking, but it won't be useful, because apart from all the technical grief of working through all those layers, what you want to do in a template is usually to invoke the Tridion APIs, and of course, the APIs that are available from the VBScript templating environment are different from the ones available via Compound Templating.

In practice, you'll probably find that your old VBScript templates are due for a re-write anyway. Having to do this occasionally is a good thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM