是否可以混合模块化模板和旧版 VBScript CT? [英] Is it possible to intermix Modular templating and legacy VBScript CT?

查看:20
本文介绍了是否可以混合模块化模板和旧版 VBScript CT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

特别是,我想到的情况是这样的:

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

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

我遇到的问题是,在我的情况下,VBS 代码在尝试访问组件字段时会中断,给出错误 13 类型不匹配......".

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")

编辑上面的 DWT 来自另一个 CT,因此它实际上是组件链接的渲染,这就是为什么按照 Nuno 的建议进行的无参数重载将无法正常工作的原因.顺便说一句,VBS 中的以下几行不会中断并给出正确的值:

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

编辑 2

Dominic 是绝对正确的:它缺少依赖项.

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

多一点洞察力,使这些信息普遍有用:

A bit more insight to make this info generally useful:

假设原始 CT 看起来像这样(VBScript [Legacy]"类型):

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

[%
Call RenderComponent(Component)
%]

这个 CT 是从 PT 调用的,也是基于 VBS 的.那个 PT 在开头有一大段#include"语句.

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.

现在情况发生了变化:正在从另一个基于 DWT 的 CT 调用同一个 CT.显然(感谢大家的宝贵帮助!),依赖项现在没有包含在任何地方.

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.

让原来的 CT 再次工作的解决方案是明确挑选并包含所有必要的 VBS TBB,所以原来的 CT 变成:

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)
%]

推荐答案

是的 - 完全可以混合和匹配旧模板和模块化模板.也许很明显,您不能在两种技术之间混合和匹配模板构建块.

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.

在 VBScript 中,错误 13 类型不匹配"有时被用作秘密代码,它的真正意思是我不认识你的一个变量的名称,(包括函数和子函数的名称)"在 VBScript 模板引擎中,页面模板中的变量可能在组件模板的范围内;例如,将#includes 放在 PT 中以便 CT 可以使用它们是很常见的.我的猜测是您的组件模板正在尝试使用这样的函数,但没有找到它.

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.

这篇关于是否可以混合模块化模板和旧版 VBScript CT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆