Forum

Thread tagged as: Question, Discussion

expiration date

Hi, Is there anyway that an item entered a portfolio (for example) you can be add expiration date? (income date - end date).

Thanks in advance. alex

alex s

alex s 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you could add a field for that. Then you'd need to add a filter when display the items.

alex s

alex s 0 points

Hi Drew, something like this? but I need a dynamic value for a dateFrom and dateTo, right? as might be? Thanks a lot.

perch_categories(array(
        'template' => 'categories.html',
        'filter' => 'date’,
        'match' => 'eqbetween',
        'value' => 'dateFrom','dateTo',
    ));
Drew McLellan

Drew McLellan 2638 points
Perch Support

So you only want items where the expiration date is in the future.

perch_categories(array(
        'template' => 'categories.html',
        'filter' => 'date',
        'match' => 'gt',
        'value' => date('Y-m-d H:i:s'),
    ));
alex s

alex s 0 points

Hi Drew, I have an error in my template of category page: Parse error: syntax error, unexpected ''filter'' (T_CONSTANT_ENCAPSED_STRING), expecting ')'

Thanks.

if (perch_get('cat')) {
                              perch_category(perch_get('cat'),array(
                                'template'=>'category_single.html'
                                'filter' => 'dateexp',
                                'match' => 'gt',
                                'value' => date('Y-m-d H:i:s'),
                            ));
                            perch_content_custom('Empresa', array(
                                'template' => 'empresa_listing.html',
                                'page'=>'/directorio/index.php',
                                'category' => perch_get('cat'),
                            ));
                            } else {
                              perch_categories();
                            }
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which line is the error on?

alex s

alex s 0 points

'filter' => 'dateexp',

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's a comma missing at the end of the line before that one.

alex s

alex s 0 points

perfect Drew, thanks again. alex