I wrote code in view action to get some data.
I can easily get a field with the brackets notation:
What I would like to do is to check if there is data in the field and if not I don't want to show the field.
How can I get Start.email in php to use it in if statement?
Thanks!
I can easily get a field with the brackets notation:
{Start.email}
What I would like to do is to check if there is data in the field and if not I don't want to show the field.
How can I get Start.email in php to use it in if statement?
<?php
if(!empty($start_email))
?>
Thanks!
Please try this code:
Does it show you the full data list ?
pr($this->data);
Does it show you the full data list ?
I am trying to do the same thing. However, the solution above does not answer the question for me. Perhaps for the OP, but I cannot figure out how to do this. I have a field that may contain a URL. If there is no URL in the field, the listing should be blank. If there is a URL, I will display a hyperlink. I cannot figure out how to pull the field value into PHP.
I have tried:
What am I missing?
I have tried:
$geturl = $row->data['venues']['venue_url'];
What am I missing?
Hi Rick,
That's in the "Action" code ? or in the listing ?
Regards,
Max
That's in the "Action" code ? or in the listing ?
Regards,
Max
In the listing you will have to do it using the PHP functions box OR the HTML box:
HTML:
PHP functions:
HTML:
Model.field:array('' => '', '*' => '{Model.field}');
PHP functions:
Model.field:return (empty($cell) ? "" : $cell);
I would like to use the PHP functions box, but I am not able to get it to do what I need. If there is a URL in the field, I need the listing to use:
If there is nothing in the cell, it should be blank. Do I somehow insert that whole code in the PHP function you show above?
<a href="{venues.venue_url}" target="_blank" class="uk-button uk-button-primary">WEB</a>
If there is nothing in the cell, it should be blank. Do I somehow insert that whole code in the PHP function you show above?
Yes, in your case the code should be:
Model.field:return (empty($cell) ? "" : '<a href="'.$row['venues']['venue_url'].'" target="_blank" class="uk-button uk-button-primary">WEB</a>');
This topic is locked and no more replies can be posted.