Hello everybody,
I consider myself less than a newbie, I have entered in processwire world after a recommendation and instantly I liked it very much specially the way to to add information to the web and get easily pages from a dataset. Before, I had to add every page, every link manually.
I do not know almost anything of programming, I took an existing webpage, from an informatics course, and I am adapting it to my interests (you can visit it at http://www.bpod.cat). I know that it has something wrong because it is not as fast as I like but this is not the main problem now.
The problem is that I would like to filter the files by date. Every day has a new file and may sometimes we add files previous to the present day. I would like that the system could filter files by date and showed, automatically, only files from present day to the past.
The script I use is:
<script>
app.controller('FotosCtrl',function($scope,$http,pw){
$scope.busca = function(){
pw.busca('template=foto, title|comentari~='+$scope.termino).then(function(data){
console.log("ENCONTRADOS",data);
$scope.encontrados=data;
$scope.termino='';
});
}
$scope.buscaFotos= function(fotos){
pw.busca(fotos).then(function(data){
$scope.encontrados=data;
console.log("todos",data)
});
}
$scope.buscaFotos('template=foto,sort=-any, sort=-mes, limit=1, sort=-ordre, ');
$scope.page=<?php echo $page->toJSON() ?>;
console.log("PAGINA", $scope.page);
});
</script>
And then, for instance, to select some files I use this sentence:
<a href ng-click="buscaFotos('template=foto,any=2017,mes=01,sort=ordre')">Gener</a>
But, I can't filter the files automatically by date (to show only present day and before).
I have searched in this forum some questions about date filtering and I do not know how to introduce the changes or have use it wrongly.
Addtionally, I have introduced some date fields, one without data (date) (to be always present day) and other with the proper day (datefixa) but I also do not know how to comparare each other to get a valid result.
I hope this question it is not out of range and someone could help me.
Have a nice day.
Xavier