I need your help

eric258

Member
Hello all,

I hope you guys can help me here is what i am trying to do

On my list, there are various chess tournaments that I plan to broadcast. What I would likr to do is that when the start date has arrived, a Live Icon appears automatically and disapears once the end date has passed...

Is there a way to do that on Fabrik?
my site is
chessbook.net
upload_2016-6-13_10-5-57.png
 
You can add a calculation element checking your dates and return the icon (resp. nothing).
 
[/code]
$startDate = '{yourtable___startdate}';
$endDate = '{yourtable___enddate}';

if (!empty($startDate) && !empty($endDate)) {
$startDate = new DateTime('{yourtable___startdate}');
$endDate = new DateTime('{yourtable___enddate}');
$today = new DateTime();

if ($today >= $startDate && $today <= $endDate) {
return '<img src="/path/to/your/icon.png" />";
}
}
return '';
[/code]

Replace the {} placeholders with your element names.

Set the Calc's "Only calc on save" to "No".

-- hugh
 
Hi Hugh,

if i were to give you access to my site backend , would you be ok to set it up for me?
I also need the listing to show in chronological order and i just cant do it
thank you for your reply
 
Upload your live icon image file using FTP or the Media Manager. Put the code that Hugh gave to you (do not include the [/code] tags) in the Calculation field, which is in the More tab on the details page of the calculation element, substituting the return value for the path/filename (i.e. wherever you uploaded it) of your icon and replacing the {} placeholders with your element names in your Fabrik list.
 
To have some help, you need to give a little more precisions ;)
hi there sorry about that
ok if you look at the capture below, it shows tournaments that are been broadcasted at the present moment on the site.
upload_2016-6-16_9-42-13.png

what I would like to do is that everytime a tournament is live, an icon Live ( 1.gif) appears on the listing and diseapear once the End date has passed.


Hugh has very kindly advised me to use a calc element and to place this code in it


[/code]
$startDate = '{yourtable___startdate}';
$endDate = '{yourtable___enddate}';

if (!empty($startDate) && !empty($endDate)) {
$startDate = new DateTime('{yourtable___startdate}');
$endDate = new DateTime('{yourtable___enddate}');
$today = new DateTime();

if ($today >= $startDate && $today <= $endDate) {
return '<img src="/path/to/your/icon.png" />";
}
}
return '';
[/code]

Replace the {} placeholders with your element names.

Set the Calc's "Only calc on save" to "No".

I replaced the placeholders with the element names below
upload_2016-6-16_9-47-4.png

The results of the code is here:

upload_2016-6-16_9-50-13.png

the other settings of the calc element are below
upload_2016-6-16_9-50-41.png

Now as you can see, the icon still does not appears on the active tournament listing
upload_2016-6-16_9-51-49.png
In the backend thoug a field appeared
upload_2016-6-16_9-53-2.png

Is there any way that you could help me set it up? I thank you for your time

Eric
 

Attachments

  • upload_2016-6-16_9-48-10.png
    upload_2016-6-16_9-48-10.png
    58.1 KB · Views: 156
Your placeholders are wrong, look at Hugh's code. You have missed out the table name (followed by 3 underscores) and the curly brackets.
 
Your placeholders are wrong, look at Hugh's code. You have missed out the table name (followed by 3 underscores) and the curly brackets.
thank you Nick,
here is the new code

$startDate = '{starting___date}';
$endDate = '{ending___date}';

if (!empty($startDate) && !empty($endDate)) {
$startDate = new DateTime('{starting___date}');
$endDate = new DateTime('{ending___date}');
$today = new DateTime();

if ($today >= $startDate && $today <= $endDate) {
return '<img src="/images/stories/1.gif"/>";
}
}
return '';

but still no luck...
 
They still aren't right, you have just put three underscores in the middle of the element name and still not included the table name. What you need is to the right of the label in the element list, i.e.:

Code:
{chess_tournaments_on_chessbook___starting_date}
{chess_tournaments_on_chessbook___ending_date}
 
They still aren't right, you have just put three underscores in the middle of the element name and still not included the table name. What you need is to the right of the label in the element list, i.e.:

Code:
{chess_tournaments_on_chessbook___starting_date}
{chess_tournaments_on_chessbook___ending_date}
hi again

I feel so stupid

$startDate = '{chess_tournaments_on_chessbook___starting_date}';
$endDate = '{chess_tournaments_on_chessbook___ending_date}';

if (!empty($startDate) && !empty($endDate)) {
$startDate = new DateTime('{chess_tournaments_on_chessbook___starting_date}');
$endDate = new DateTime('{chess_tournaments_on_chessbook___ending_date}');
$today = new DateTime();

if ($today >= $startDate && $today <= $endDate) {
return '<img src="/images/stories/1.gif"/>";
}
}
return '';


still no luck i have tried to edit the starting date on the listing but still no icon

and the path to the icon is right i think
upload_2016-6-16_10-32-38.png
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top