Closed (fixed)
Project:
Views PHP
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
30 Aug 2011 at 18:15 UTC
Updated:
6 Mar 2021 at 18:24 UTC
Hello,
Could someone help me please ?
I looking for a way to test the value of a field. If an image field is empty, i'd like to display another field.
Here's what I have in output, but it doesn't work.
<?php
if ($row->field_eve_image_fid>0) {
$destitle = $row->field_eve_image_fid;
}
else {
$destitle = $row->field_event_date_value;
}
return $destitle;
?>
Thank you very much.
Comments
Comment #1
drupalerocant commentedHello,
This is what i did to sort it out. What i have is an image preview of a video (field_field_exp_video[0][rendered]['#markup']) to display in case the user did'nt upload a thumbnail for this video (field_field_exp_thumbvideo[0][rendered]['#markup']). This is the code I used for Views PHP 7.x-1.x-dev in the output code:
I hope it helps!
Comment #2
drupalerocant commentedSorry!
Previous code was not correct!
This is the code I use now, without any warnings at the moment:
Comment #3
johnvsolved?