I created a view showing the latest closed quizzes, and the view file tpl.php for theming, now I need to test if a quiz is closed or not. How can I do this?
I did this in the Row style output template "views-view-fields.tpl.php":
<?php
if ($fields['quiz_close']->content!='0 sec'):
?>
<?php foreach ($fields as $id => $field): ?>
<?php if (!empty($field->separator)): ?>
<?php print $field->separator; ?>
<?php endif; ?>
<<?php print $field->inline_html;?> class="views-field-<?php print $field->class; ?>">
<?php if ($field->label): ?>
<label class="views-label-<?php print $field->class; ?>">
<?php print $field->label; ?>:
</label>
<?php endif; ?>
<?php
// $field->element_type is either SPAN or DIV depending upon whether or not
// the field is a 'block' element type or 'inline' element type.
?>
<<?php print $field->element_type; ?> class="field-content"><?php print $field->content; ?></<?php print $field->element_type; ?>>
</<?php print $field->inline_html;?>>
<?php endforeach; ?>
<?php endif; ?>
And the result is as follows:
Quiz 2
Quiz 1
- john
- peter
- martin
But only the "Quiz 1" should appear because it is already closed!
I tried to put in the "Style output" view template file and "Display output" view template file but the code "if ($fields['quiz_close']->content!='0 sec'):" did not work. What am I doing wrong?
obs: The "close time" field is configurated to "Time ago" date format.
Sorry for my bad English.
Comments
Comment #1
gutomec CreditAttribution: gutomec commentedPlease, help me!
Comment #2
gutomec CreditAttribution: gutomec commentedsomeone willing to help me please?
Comment #3
-remove-me CreditAttribution: -remove-me commentedThe problem still persists in version 6.x-4.0.
I can't find a way to filter only the open quizes in my view.
Comment #4
westie CreditAttribution: westie commentedsubscribe
Comment #5
djdevinThis issue is being closed because it is filed against a version that is no longer supported.
Comment #6
djdevinThis issue is being closed because it is filed against a version that is no longer supported.