0
我正努力根据上下文与babelTranslation获取资源ID?MODx BabelTranslation返回资源ID?
这里是我的榜样
[[!getContext]]
[[BabelTranslation? &contextKey=`[[!getContext]]` &resourceId=`4`]]
片段的getContext
<?php
$contextKey = $modx->context->key;
return $contextKey
用这种方法我alsways得不到任何回报,我不知道为什么,我希望它会返回ID OD从翻译资源上下文 ;
你需要echo $ contextKey才能返回它。 –
@SeanKimball返回在片段中实际上是正确的;片段被执行为php函数,实际上它确实期望返回。 –