-
☆ A M B ☆
- 179 Posts
Hi folks,
so, with the document-specific variable "template" I can get the ID of the template being used for the document. But how do I get the name of the template?
Why do I need this? I want so place some images within the template and want them to be correctly displayed - even if I rename the template later. Also I want to use this for including my css files. With a path like "/assets/templates/XYZ/css/layout.css" I get a problem when I rename XYZ.
How can I resolve the name of the used template?
Best
Hans
LOL! I saw this thread started playing with it...
<?php
$table = $modx->db->config['table_prefix']."site_templates";
$templateid = $modx->documentObject['template'];
$result = $modx->db->getValue($modx->db->select("templatename", $table, "id = $templateid"));
print $result;
?>
And then couldn’t find the thread, now when I finally found it, I have to post my code too!
Video answer:
http://www.youtube.com/watch?v=ke6JNVK3AWQ&feature=PlayList&p=9F3C208D7BFC7D96&playnext=1&playnext_from=PL&index=21