简体   繁体   中英

MODX Evolution. It is possible to get Template Variable ID in template?

I need to know which ID the Template Variable (TV) has, to put it into a form in the template.

Something like this:

<input type="text" value="[template_variable_id]" />

Does MODX Evo have some special tag for it, which can be used in templates?

That's because $modx->resource is always the currently loaded document. If you're calling a snippet, you need to pass in the current ID:

[[!mySnippet? &resourceId=`[[*id]]`]]

Snippet mySnippet

  $resource = $modx->getObject('modResource',$resourceId);
    $template = $resource->get('template');
    echo $template;

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