Closed GoldMnaPro2014 closed 6 years ago
I wouldn't recommend changing the format. If you are adding a new movie/tv-series it's going to get added with new lines. And those will not work instead.
This is the function that turns newlines into an array:
public function getList($field) {
$list = $this->{$field};
$list = preg_split("/\r?\n/", $list);
$tmp = array();
foreach($list as $l) {
if(strlen(trim($l)) > 0) {
$tmp[] = $l;
}
}
return $tmp;
}
And this function should split "Action,Adventure"... into an array so it can be processed. But you have no way of knowing if you are going to use getList or getListCSV on that field.
public function getListCSV($field) {
$list = $this->{$field};
$list = explode(",", $list);
$tmp = array();
foreach($list as $l) {
if(strlen(trim($l)) > 0) {
$tmp[] = $l;
}
}
return $tmp;
}
So I would use the "Update all" function and get a proper format on all movies/tv-series instead.
I need help, there is a code, it takes all the data from their database, but makes them ALL in one line, how to make it split them into each element (Before) (If they were added to the database separated by commas (In line), and not on everyone on the new line) {assign var=genres value=$movie->getList('genres')} {foreach $genres as $g}{if !$g@first}, {/if}{$g}{/foreach}