I have a list, 'Titles', that has 3 elements (excluding ID and timestamp). Two of the elements (title and title_article) have been loaded via a CSV import. They show up fine in List>Show Data for the list and they are good in the underlying database table (ds_titles).
The 3rd element (full_title) is supposed to be a combination of the title and title_article elements, such that if there is a value for title_article it is appended to the title, and saved in the full_title element. To do this I have the element full_title defined as a field and have the following PHP code in the default section of the element definition (with eval set to YES).
$full = {ds_titles___title};
$article = {ds_titles___title_article};
if (!is_null($article)) $full = $full . ", " . $article;
return $full;
At the very least I would expect List>Show Data to contain the title element (based on lines 1 & 4). However, List>Show Data has the Full Title column, but it is empty. It does not matter whether I have the placeholders raw (as above) or have them surrounded by ' or ". The result is the same. In the underlying database table, all the values are shown as NULL.
I would be most grateful if someone could help me understand what I am doing wrong.
Michael Barraclough
The 3rd element (full_title) is supposed to be a combination of the title and title_article elements, such that if there is a value for title_article it is appended to the title, and saved in the full_title element. To do this I have the element full_title defined as a field and have the following PHP code in the default section of the element definition (with eval set to YES).
$full = {ds_titles___title};
$article = {ds_titles___title_article};
if (!is_null($article)) $full = $full . ", " . $article;
return $full;
At the very least I would expect List>Show Data to contain the title element (based on lines 1 & 4). However, List>Show Data has the Full Title column, but it is empty. It does not matter whether I have the placeholders raw (as above) or have them surrounded by ' or ". The result is the same. In the underlying database table, all the values are shown as NULL.
I would be most grateful if someone could help me understand what I am doing wrong.
Michael Barraclough