Good day. There is a journal site. Installed MODX 2.2.7, Articles 1.6.0. For each issue of the journal, a container is created in Articles, to which articles are added. I need to output TV and other parameters for all articles of the journal release in the prepared XML template, some of which must be preprocessed. To get the articles I use getResources.
Template:
[[getResources?
&parents=`6701`
&tpl=`TplArticles`
&showHidden=`1`
&limit=`8`
&includeContent=`1`
&includeTVs=`1`
&processTVs=`1`
&sortby=`publishedon`
&sortdir=`ASC`
&showLog=`1`]]
TplArticles:
<journal_article publication_type="full_text">
<titles>
<title>
[[+pagetitle]]
</title>
</titles>
<contributors>
<person_name sequence="first" contributor_role="author">
<given_name>Ann P.</given_name>
<surname>Shirakawa</surname>
</person_name>
<organization sequence="additional" contributor_role="author">Sample Organization</organization> / an organization that has authored the article
</contributors>
<publication_date media_type="print">
<year>[[+publishedon:strtotime:date=`%Y`]]</year>
</publication_date>
<pages>
<first_page>[[+tv.art_pages:limit=`3`]]</first_page>
</pages>
<publisher_item>
<identifier id_type="pii">[[+tv.art_doi:stripString=`10.28824/`]]</identifier>
</publisher_item>
<doi_data>
<doi>[[+tv.art_doi]]</doi>
<resource>http://site.com/[[~[[+id]]]]</resource>
</doi_data>
<citation_list>
[[doiCititationList]]
</citation_list>
</journal_article>
Problem in snippet doiCititationList. I need to output the processed content of TV art_lit for each individual article in the container:
<citation key="key-10.9876/S0003695199034166-1"> // key must be generated by pattern key-art_doi-number in list
<unstructured_citation>String 1</unstructured_citation>
</citation>
<citation key="key-10.9876/S0003695199034166-2">
<unstructured_citation>String 2/unstructured_citation>
</citation> ......
At the moment there is no output. [[*tv.art_lit]] works, and displays a list like <ul> <li> ... </ li> <li> ... </ li> ... </ ul>.
doiCititationList:
$tv_param = array(
'contentid' => $id // also trying $resourceId
, 'tmplvarid' => 11 // art_lit id, also trying $tvId
);
$tvx = $modx->getObject('modTemplateVarResource', $tv_param);
$artlit = $tvx->get('value');
$str = str_replace(array('<li>', '</li>'), array($tvr.'<unstructured_citation>', '</unstructured_citation></citation>'), $artlit);
return $str;
As I understand it, the snippet does not determine the ID of the articles in the container, but instead uses the ID of the final page of the template output. What could be the problem? Thanks in advance!