We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37449
    • 57 Posts
    Is there a way to get at the template variables within Archivist?

    I have a TV for my categories on my blog resources (tv is an auto-tag), and although I can get the archivist call to work in pulling out either date-related posts, or category related posts, I can’t get at the tv for the category within the archivist call.

    So, TV is tvBlogTags (auto-tag, delimiter = ,)
    Parent page call (id=7):
    [[$list-blog-post]]
    


    $list-blog-post code:
    <div>
     [[!getResources?  
        &parents=`[[*id]]`  
        &tpl=`list-blog-post-tpl`
        &limit=`5`  
        &sortdir=`DESC`  
        &includeTVs=`1`
        &processTVs=`1`
        &includeContent=`1`   
        &depth=`0`  
        &sortby=`publishedon` 
        ]]  
    </div><!-- eof list-docs -->
    


    list-blog-post-tpl code - works perfectly for the $list-blog-post call:
    <div class="blogPost">
      <h3 class="blogPageTitle">[[+pagetitle]]</h3>
      <h5 class="blogPageLongTitle">[[+longtitle]]</h5>
      <p class="blogContentText>">[[+introtext]]<a href="[[~[[+id]]]]">  <span style="font-size : small;"> Read more..</span>.</a></p>
      <div class="blogDocumentInfo">Published on [[+publishedon:strtotime:date=`%b %d %Y`]] under [[+tv.tvBlogTags]]</div>
      <div class="clear"></div>
    </div>
    <!-- eof item -->
    


    Archivist call on resource (id = 40)
    [[!getArchives? &parents=`7` &tpl=`list-blog-post-tpl`
    ]]
    



    So, is there a way to get at the tv in the template?


    Modx 2.21-pl (trad)
    PHP 5.3.0
    Archivist 1.1.0
    getResources 1.3.1


    Many thanks
    Daz
      formerly sumodaz on here!
      • 37449
      • 57 Posts
      OK, so the answer to this question is YES!!

      By combining the getResourceField call into the template, I was able to get the category from my TV tvBlogTags and hey presto!

      <h4 class="blogPageTitle">[[+pagetitle]] ([[+longtitle]])</h4>
      <p class="blogSummaryText">[[+introtext]]<a href="[[~[[+id]]]]">  >>></a></p>
      <div class="blogDocumentInfo">Published on [[+publishedon:strtotime:date=`%b %d %Y`]] under 
      [[getResourceField? &id=`[[+id]]` &field=`tvBlogTags` &isTV=`1` &processTV=`1`]]</div>
      <!-- eof list-blog-archive-post -->
      

        formerly sumodaz on here!