- Posts: 6
- Thank you received: 0
display article from a date to another date
- Alexandre Legendre
- Topic Author
- Offline
- Fresh Boarder
Less
More
7 years 11 months ago #8688
by Alexandre Legendre
display article from a date to another date was created by Alexandre Legendre
Hi,
Is there a way to display article from a specific period ? I want to create a timeline only for articles published in 2015. Is it possible ? How ?
Is there a way to display article from a specific period ? I want to create a timeline only for articles published in 2015. Is it possible ? How ?
Please Log in or Create an account to join the conversation.
7 years 11 months ago #8689
by Kiên
Replied by Kiên on topic display article from a date to another date
I think you can create a separate category for this article, and only choose category in module.
Please Log in or Create an account to join the conversation.
- Alexandre Legendre
- Topic Author
- Offline
- Fresh Boarder
Less
More
- Posts: 6
- Thank you received: 0
7 years 11 months ago - 7 years 11 months ago #8690
by Alexandre Legendre
Replied by Alexandre Legendre on topic display article from a date to another date
I had thought about this solution but It means to create a large number of categories (2015 was only an exemple) and a lot of changes in articles.
I thought about creating in the xml file two fields (begin/end) and use this parameter in the database request to add a "where" on "creation date column.
But I don't know where to find the database request.
I thought about creating in the xml file two fields (begin/end) and use this parameter in the database request to add a "where" on "creation date column.
But I don't know where to find the database request.
Last edit: 7 years 11 months ago by Alexandre Legendre.
Please Log in or Create an account to join the conversation.
7 years 11 months ago #8691
by Kiên
Replied by Kiên on topic display article from a date to another date
the query on helper.php and you can setstate for this: $model->setState
Please Log in or Create an account to join the conversation.
- Alexandre Legendre
- Topic Author
- Offline
- Fresh Boarder
Less
More
- Posts: 6
- Thank you received: 0
7 years 11 months ago - 7 years 11 months ago #8692
by Alexandre Legendre
Replied by Alexandre Legendre on topic display article from a date to another date
Thanks.
So I have created in the XML file two fields :
<field name="debut" type="calendar" label="Date de début" size="22" format="%Y-%m-%d" filter="user_utc" />
<field name="fin" type="calendar" label="Date de fin" size="22" format="%Y-%m-%d" filter="user_utc" />
In the HELPER, I have added those lines :
$model->setState('filter.datedebut', (int) $params->get('debut'));
$model->setState('filter.datefin', (int) $params->get('fin'));
But I don't know how to set that the articles have to be between "datedebut" and "datefin".
Could you help me ?
So I have created in the XML file two fields :
<field name="debut" type="calendar" label="Date de début" size="22" format="%Y-%m-%d" filter="user_utc" />
<field name="fin" type="calendar" label="Date de fin" size="22" format="%Y-%m-%d" filter="user_utc" />
In the HELPER, I have added those lines :
$model->setState('filter.datedebut', (int) $params->get('debut'));
$model->setState('filter.datefin', (int) $params->get('fin'));
But I don't know how to set that the articles have to be between "datedebut" and "datefin".
Could you help me ?
Last edit: 7 years 11 months ago by Alexandre Legendre.
Please Log in or Create an account to join the conversation.
7 years 11 months ago #8693
by Kiên
Replied by Kiên on topic display article from a date to another date
I think you try again:
and remove
Code:
$model->setState('filter.date_filtering', 'range');
$start_date = strtotime((int) $params->get('debut'));
$start_date = date("Y-m-d h:i:s", $start_date);
$end_date = strtotime((int) $params->get('fin'));
$end_date = date("Y-m-d h:i:s", $end_date);
$model->setState('filter.start_date_range', $start_date);
$model->setState('filter.end_date_range', $end_date);
Code:
$model->setState('filter.datedebut', (int) $params->get('debut'));
$model->setState('filter.datefin', (int) $params->get('fin'));
Please Log in or Create an account to join the conversation.
Time to create page: 0.296 seconds