1
0

Finished BlogPost

This commit is contained in:
2014-07-19 18:25:35 +02:00
parent c2a829ac6a
commit 09488796d8
6 changed files with 70 additions and 7 deletions

View File

@@ -97,10 +97,26 @@ class BlogPost extends CActiveRecord
return parent::model($className);
}
//####################################
//########### MY FUNCTIONS ###########
//####################################
/**
* @return DateTime
*/
public function getDateTime() {
return new DateTime($this->Date);
}
/**
* @return string
*/
public function getLink() {
return '/blog/' . $this->ID;
$name = $this->Title;
$name = str_replace(' ', '_', $name);
$name = preg_replace("/[^A-Za-z0-9_]/", '', $name);
return '/blog/' . $this->ID . '/' . $name;
}
}