Search code examples
tridion

Is it possible to intermix Modular templating and legacy VBScript CT?


In particular, the case I have in mind is this:

@@RenderComponentPresentation(Component, "<vbs-legacy-ct-tcm-uri>")@@

The problem I'm having is that in my case VBS code breaks when it tries to access component fields, giving "Error 13 Type mismatch ..".

(So, if I were to give the answer, I'd say: "Partially, of no practical use")

EDIT The DWT above is from another CT, so effectively it's a rendering of component link, that's why parameterless overload as per Nuno's suggestion won't work unfortunately. BTW, the following lines inside VBS don't break and give correct values:

WriteOut Component.ID
WriteOut Component.Schema.Title

EDIT 2

Dominic was absolutely wright: it's a missing dependencies.

A bit more insight to make this info generally useful:

Suppose, the original CT looked like this ("VBScript [Legacy]" type):

[%
Call RenderComponent(Component)
%]

This CT was meant to be called from a PT, also VBS-based. That PT had a big chunk of "#include" statements in the beginning.

Now the story changes: the same CT is being called from another, DWT-based, CT. Obviously (thanks you all for your invaluable help!), dependencies are now not being included anywhere.

The solution to make original CT working again is to explicitly hand-pick and include all necessary VBS TBBs, so the original CT becomes:

[%
#include "tcm:<uri-of-vbs-tbb>"
Call RenderComponent(Component)
%]

Solution

  • Yes - it's perfectly possible to mix and match legacy and modular templates. Perhaps obviously, you can't mix and match template building blocks between the two techniques.

    In VBScript "Error 13 Type mismatch" is sometimes used as a secret code that really means "I don't recognise the name of one of your variables, (including the names of Functions and Subs)" In the VBScript templating engine, variables from the page template could be in scope in your component template; it was very common, for example, to put the #includes in the PT so they could be used by the CT. My guess is that your component template is trying to use such a Function, and not finding it.