try this(untested) :
create snippet ’getTvDescription’:
<?php
//[[!getTvDescription? &tvname=`myTv`]]
$tvname=$modx->getOption('tvname',$scriptProperties,'');
if ($tv=$modx->getObject('modTemplateVar',array('name'=>$tvname))){
return $tv->get('description');
}
return '';
call it:
[[!getTvDescription? &tvname=`myTv`]]
-
☆ A M B ☆
- 339 Posts
Thank you a lot!
How do I get all TVs of the same category? That is another thing I did not find by searching.
you can try something like this snippet (also untested):
<?php
//[[!getTvs? &category=`myCategoryId` &tpl=`tvInfo`]]
$category=$modx->getOption('category',$scriptProperties,'');
$tpl=$modx->getOption('tpl',$scriptProperties,'');
$c=$modx->newQuery('modTemplateVar');
if (!empty($category)){
$c->where(array('category'=>$category));
}
if ($collection=$modx->getCollection('modTemplateVar',$c)){
foreach ($collection as $object){
$output.=$modx->getChunk($tpl,$object->toArray());
}
}
return $output;
with this chunk ’tvInfo’:
<tr><td>[[*[[+name]]]]</td><td>[[+description]]</td></tr>
-
☆ A M B ☆
- 339 Posts
I entered them all manually but am still interested in a package of that function.
I guess thet this usage applies quite often.
Hi,
Anyone know if this code will work in Evo?
Quote from: diatomin at Sep 23, 2011, 12:38 AMHi,
Anyone know if this code will work in Evo?
Definitely not. It's strictly Revolution code.
You could do the same thing in Evo, but you'd have to write very different code.