2018-03-21 11:13:03 -05:00
|
|
|
<?php
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2024-06-29 12:10:21 -05:00
|
|
|
class Article
|
|
|
|
{
|
|
|
|
private $ID;
|
|
|
|
private $Title;
|
|
|
|
private $Cover;
|
|
|
|
private $Author;
|
|
|
|
private $Content;
|
|
|
|
private $PostDate;
|
|
|
|
private $Comments;
|
|
|
|
private $Description;
|
|
|
|
|
|
|
|
public function __construct(int $id)
|
|
|
|
{
|
|
|
|
$this->ID = $id;
|
|
|
|
|
|
|
|
$getArticle = $db->Handle->prepare('SELECT * FROM ms_articles WHERE id = :id');
|
|
|
|
$getArticle->bindValue(':id', $id, PDO::PARAM_INT);
|
|
|
|
$getArticle->execute();
|
|
|
|
|
|
|
|
$ArticleInfo = $getArticle->fetch();
|
|
|
|
|
|
|
|
$getArticle->closeCursor();
|
|
|
|
|
|
|
|
$this->Title = $ArticleInfo['articleName'];
|
|
|
|
$this->Cover = $ArticleInfo['articleCover'];
|
|
|
|
$this->Author = $ArticleInfo['articleAuthor'];
|
|
|
|
$this->Content = $ArticleInfo['articleContent'];
|
|
|
|
$this->PostDate = betterDate($ArticleInfo['articleDate']);
|
|
|
|
$this->Comments = $ArticleInfo['articleComments'];
|
|
|
|
$this->Description = $ArticleInfo['articleDescription'];
|
|
|
|
}
|
2024-06-29 08:07:30 -05:00
|
|
|
|
2024-06-29 12:10:21 -05:00
|
|
|
public function __get($what)
|
|
|
|
{
|
|
|
|
return property_exists($this, $what) ? $this->{$what} : null;
|
2018-03-21 11:13:03 -05:00
|
|
|
}
|
2024-06-29 12:10:21 -05:00
|
|
|
}
|