NewsItem images: file / url
This commit is contained in:
1 parent
3f726e884d
commit
d6a90d8144
2 files changed
+10
-4
No files matched your search
@@ -16,11 +16,17 @@ class NewsSource {
|
||||
|
||||
class NewsImage extends Model {
|
||||
public $id;
|
||||
public $url;
|
||||
public $title;
|
||||
public $url;
|
||||
|
||||
public function getUrl() {
|
||||
return '/img/news/' . $this->url;
|
||||
public function __construct($data, $urlPrefix = '/') {
|
||||
parent::__construct($data);
|
||||
|
||||
// Deserialisatie van JSON heeft url in data,
|
||||
// lezen uit database heeft file en (als het goed is) urlPrefix
|
||||
if(isset($data->file)) {
|
||||
$this->url = $urlPrefix . $data->file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user