Hello !
I have a problem with getpage. I want to select display of pages according to the reference.
with this code :
<?php
$parametres = array(
'element' => 'getResources',
'elementClass' => 'modSnippet',
'parents' => $modx->resource->get('id'),
'depth' => 2,
'limit' => 6,
'pageVarKey' => 'page',
'includeTVs' => 1,
'includeContent' => 1,
'includeTVList' => 'ma_tv,tarif,ref,tel,departement',
'tpl' => 'article',
'processTVs' => 1,
'resources' => '-12,-13,-137',
'tvFilters' =>'',
'pageLastTpl' => '<li class="control"><a[[+title]] href="[[+href]]">Dernière page</a></li>',
'pageFirstTpl' => '<li class="control"><a[[+title]] href="[[+href]]">Première page</a></li>',
);
$ref = $_POST["reference"];
echo "la référence est".$ref;
if (!empty($_POST['reference'])){
$parametres = array_merge($parametres, array(
'tvFilters' => 'ref==FG1',
'resources' => '-12,-13,-137',
));
return $modx->runSnippet('getPage', $parametres);
print_r($parametres);
echo " ça marche";
}
else{
echo " reference vide";
}
If I puts a value directly in ref (tv variable), my code work !
But il want that the value is if ref==$ref !!!