6

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)
%]
esteewhy
  • 1,300
  • 13
  • 23

3 Answers3

5

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.

Dominic Cronin
  • 6,062
  • 2
  • 23
  • 56
  • 1
    I would agree that this seems the most logical explanation for the error you are seeing. To my knowledge there is nothing wrong with invoking a "classic" script CP render from a compound one... – Bjørn van Dommelen Oct 26 '12 at 13:37
4

I know that you can render a Modular Page Template with VBScript Component Presentations, and also a VbScript page template can render a modular Component Template.

Your error is possibly due to something else? Have you tried just using the regular @@RenderComponentPresentation()@@ call without specifying which template?

Nuno Linhares
  • 10,214
  • 1
  • 22
  • 42
  • 1
    I also think your error is due to something else. For the first parameter did you try "Component.ID" instead of just "Component"? – Nickoli Roussakov Oct 24 '12 at 15:32
  • @Nickoli Thought about (and tried) that too, but the deal was that even in the bottom-most VBS code it was still possible to access Component.ID, so definitely, the item was passed there far just fine. – esteewhy Nov 05 '12 at 13:28
2

The Page Template can render Compound Templates of different flavors - for example Razor, VBS, or XSLT.

The problem comes from the TBBs included in the Templates. Often the Razor templates will need to call functions that only exist in VBScript. So, the starting point when migrating templates is always to start with the helper functions and utility libraries. Then migrate the most generic PT / CT you have to the new format (Razor, XSLT, DWT, etc). This provides a nice basis to migrate the rest of the Templates as you have time to the new format.

robrtc
  • 2,747
  • 1
  • 17
  • 22
  • Robert, thank you for suggestion, it's n-th time i'm hearing about this fabulous Razor, and cannot wait to try it (i've missed good opportunity on our last proj:-/). But, I can only dream about using a *proper* tools for the job. (It's a bitter fun to see comment in a template code: "Used in 90% of the site.") – esteewhy Nov 05 '12 at 13:37