+
+
diff --git a/www/protected/components/widgets/BlogLink.php b/www/protected/components/widgets/BlogLink.php
new file mode 100644
index 0000000..9032261
--- /dev/null
+++ b/www/protected/components/widgets/BlogLink.php
@@ -0,0 +1,14 @@
+date == null)
+ $this->date = new DateTime('2000-01-01');
+
+ $this->render('blogLink');
+ }
+}
\ No newline at end of file
diff --git a/www/protected/components/widgets/views/blogLink.php b/www/protected/components/widgets/views/blogLink.php
new file mode 100644
index 0000000..9d1420a
--- /dev/null
+++ b/www/protected/components/widgets/views/blogLink.php
@@ -0,0 +1,10 @@
+
+
+
\ No newline at end of file
diff --git a/www/protected/controllers/BlogPostController.php b/www/protected/controllers/BlogPostController.php
index 72ce5f9..d833ec8 100644
--- a/www/protected/controllers/BlogPostController.php
+++ b/www/protected/controllers/BlogPostController.php
@@ -125,10 +125,16 @@ class BlogPostController extends MSController
*/
public function actionIndex()
{
- $dataProvider=new CActiveDataProvider('BlogPost');
- $this->render('index',array(
- 'dataProvider'=>$dataProvider,
- ));
+ $criteria = new CDbCriteria;
+ $criteria->order = "Date DESC";
+
+ $all = BlogPost::model()->findAll($criteria);
+
+ $this->render('index',
+ [
+ 'blogposts' => $all,
+ ]
+ );
}
public function actionAjaxMarkdownPreview() {
diff --git a/www/protected/models/BlogPost.php b/www/protected/models/BlogPost.php
index 42afb43..2374f3e 100644
--- a/www/protected/models/BlogPost.php
+++ b/www/protected/models/BlogPost.php
@@ -96,4 +96,11 @@ class BlogPost extends CActiveRecord
{
return parent::model($className);
}
+
+ /**
+ * @return string
+ */
+ public function getLink() {
+ return '/blog/' . $this->ID;
+ }
}
diff --git a/www/protected/views/blogPost/admin.php b/www/protected/views/blogPost/admin.php
index 27bcd32..5aa6393 100644
--- a/www/protected/views/blogPost/admin.php
+++ b/www/protected/views/blogPost/admin.php
@@ -49,7 +49,7 @@ or =) at the beginning of each of your search values to specify how the c
'columns'=>array(
'ID',
'Date',
- 'Content',
+ 'Title',
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
),
diff --git a/www/protected/views/blogPost/index.php b/www/protected/views/blogPost/index.php
index cda5315..36ebb6f 100644
--- a/www/protected/views/blogPost/index.php
+++ b/www/protected/views/blogPost/index.php
@@ -1,6 +1,6 @@
selectedNav = 'blog';
?>
-Blog Posts
+
-widget('bootstrap.widgets.TbListView',array(
- 'dataProvider'=>$dataProvider,
- 'itemView'=>'_view',
-)); ?>
\ No newline at end of file
+
+
+ widget('BlogLink',
+ [
+ 'date' => new DateTime($blogpost->Date),
+ 'caption' => $blogpost->Title,
+ 'link' => $blogpost->getLink(),
+ ]);
+ }
+ ?>
+
+
\ No newline at end of file
diff --git a/www/protected/views/blogPost/view.php b/www/protected/views/blogPost/view.php
index 7abeafd..0a2b4ed 100644
--- a/www/protected/views/blogPost/view.php
+++ b/www/protected/views/blogPost/view.php
@@ -15,8 +15,6 @@ $this->breadcrumbs = array(
-
View BlogPost #ID; ?>
-
Content); ?>