<![CDATA[ YAMS - how to retrive a "general" value? [SOLVED] - My Forums]]> https://forums.modx.com/thread/?thread=71978 <![CDATA[YAMS - how to retrive a "general" value? [SOLVED]]]> https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-400901 I want to give an ID to the "body" (for CSS selection) but if I use 'pagetitle' it changes with the language. I was looking for the 'Internal Name' Document Object, but it doesn't seems to exhist.
Thank you]]>
andrearicci Nov 21, 2011, 07:06 AM https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-400901
<![CDATA[Re: YAMS - how to retrive a (Best Answer)]]> https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-402162
That looks quite perfected!

Thank you too!]]>
binaerstrom Dec 02, 2011, 05:32 AM https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-402162
<![CDATA[Re: YAMS - how to retrive a]]> https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-402161 GetField snippet, that should be installed by default.
The default call [[GetField]] already gives me the pagetitle of the current document, but can retrive other fields.
Now in my CSS I can point a document by its id, without language worries, even with yams:
<body id="[[GetField]]" class="[[GetTemplateName]]">

If not using Yams it would be simply:
<body id="[*pagetitle*]" class="[[GetTemplateName]]">
.
As you can see I also give the body a class based on the template, so I can easilly vary styles from my CSS witouth having to touch the templates any more.
I specially like this:
<body id="[*alias*]" class="[[GetTemplateName]] [*layout*] [[GetField? &field=`alias` &parent=`1`]]">
]]>
andrearicci Dec 02, 2011, 05:28 AM https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-402161
<![CDATA[Re: YAMS - how to retrive a]]> https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-402146
I had a similar problem and got across with the MODx API (http://wiki.modxcms.com/index.php/API:getTemplateVarOutput). I created a little snippet (it's really just a basic function call) that takes two values (docID and TVname) and returns the value of the TV. I used this to get the link_attributes from a child document on the parent document.

<?php

/* 
*  Snippet call example: [[getTVvalue? &tvName=`link_attributes`, &docID=`13`]]
*  &tvName -> name of the TV (e.g. link_attributes)
*  &docID -> document ID (e.g. 13)
*/
 
$tvValStr = $modx->getTemplateVarOutput($tvName, $docID);
return ($tvValStr[$tvName]);

?>


Just create a new snippet add the code and place the snippet call inside your template.


Cheers,
Boris]]>
binaerstrom Dec 02, 2011, 03:50 AM https://forums.modx.com/thread/71978/yams---how-to-retrive-a-general-value#dis-post-402146