id = $id; $result = DB::query("SELECT * FROM news WHERE id=:id", [':id' => $this->id]); if (!empty($result)) { $this->table = (object) $result[0]; } else { $this->table = (object) []; } } public function i($key) { return $this->table->$key ?? null; } public function view() { echo '
' . Date::zmdate($this->table->time) . '
' . $this->table->body . '
Удалить
'; } }