I'd like to ouput a list ov TV values with their caption as titles. Is this possible? How? and what if it is multilanguage with YAMS? something like:
<li title="[[howDoIgetmyTVCaption?]]">[[YAMS? &get=`tv` &from=`myTemplateVariable`]]</li>
(or eventually the same in a table)
thank you
[edit] I'm getting close, but...
I put this call in my page:
[[getTvCaption? &wichTV=`[[YAMS? &get=`tv` &from=`workTechnique`]]`]]
where
YAMS? &get=`tv` &from=`workTechnique` should be
workTechnique_en and the
getTvCaption snippet is:
<?php
$tvCaption = $modx->db->getValue( $modx->db->select( 'caption', $modx->getFullTableName('site_tmplvars'), 'name='.$wichTV ));
//return $wichTV;
return $tvCaption;
?>
I get this error:
« Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[[YAM'... at line 1 »
SQL: SELECT caption FROM `isabella_modx`.`modx_site_tmplvars` WHERE name=[[YAM ...
I had to study the database tables, of course, and I was expecting that the query should be translated from modx to mysql to retrive the value in the column 'caption' where the corresponding value in the 'name' column is "workTechnique_en". Of course to debug I tryied to use the value 'workTechnique_en' in the query in place of the variable '$wichTV', getting the similar error
« Execution of a query to the database failed - Unknown column 'workTechnique_en' in 'where clause' »
SQL: SELECT caption FROM `isabella_modx`.`modx_site_tmplvars` WHERE name=workTechnique_en
while, if I change the end of the snippet to
i get the value of the first 'caption' of the table.
if I just put "return $wichTV;" it gives me its right YAMS value (workTechnique_en).
Quite confused, am I?

to summarize:
1. where's the error in my query? (+is there any tutorial online?)
2. is that the right way to pass a yams ouput to the snippet?
Thank you
[ed. note: andrearicci last edited this post 14 years, 10 months ago.]