diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-03 09:18:04 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-04-03 09:18:04 +0000 |
commit | 1ea82fe304b680eb9f84c24b98eb718ca9d59316 (patch) | |
tree | afce9a9a4a3ccd7518780361775bc3b485a92a8a | |
parent | 5aa0d6b051f0cd644016a3a2eeb3fc6ada3dae0b (diff) | |
download | elgg-1ea82fe304b680eb9f84c24b98eb718ca9d59316.tar.gz elgg-1ea82fe304b680eb9f84c24b98eb718ca9d59316.tar.bz2 |
Blog update: you can post and view blog entries.
git-svn-id: https://code.elgg.org/elgg/trunk@381 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/blog/index.php | 6 | ||||
-rw-r--r-- | mod/blog/views/default/blog/view.php | 26 | ||||
-rw-r--r-- | mod/blog/views/default/object/blog.php | 41 |
3 files changed, 73 insertions, 0 deletions
diff --git a/mod/blog/index.php b/mod/blog/index.php index 1462d0745..23ccb9dcb 100644 --- a/mod/blog/index.php +++ b/mod/blog/index.php @@ -16,6 +16,12 @@ // Get the current page's owner
$page_owner = page_owner_entity();
+ // Get any blog posts to display
+ $posts = $page_owner->getObjects('blog');
+
+ // Display them
+ $body = elgg_view("blog/view",array('posts' => $posts));
+
// Display page
page_draw(sprintf(elgg_echo('blog:user'),$page_owner->name),$body);
diff --git a/mod/blog/views/default/blog/view.php b/mod/blog/views/default/blog/view.php new file mode 100644 index 000000000..24d0bde7d --- /dev/null +++ b/mod/blog/views/default/blog/view.php @@ -0,0 +1,26 @@ +<?php
+
+ /**
+ * Elgg blog view page
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Ben Werdmuller <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ * @uses $vars['posts'] An array of posts to view
+ */
+
+ // If there are any posts to view, view them
+ if (is_array($vars['posts']) && sizeof($vars['posts']) > 0) {
+
+ foreach($vars['posts'] as $post) {
+
+ echo elgg_view_entity($post);
+
+ }
+
+ }
+
+?>
\ No newline at end of file diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php new file mode 100644 index 000000000..74b3b7c01 --- /dev/null +++ b/mod/blog/views/default/object/blog.php @@ -0,0 +1,41 @@ +<?php
+
+ /**
+ * Elgg blog individual post view
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Ben Werdmuller <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ *
+ * @uses $vars['entity'] Optionally, the blog post to view
+ */
+
+ if (isset($vars['entity'])) {
+
+?>
+
+ <div class="blog-post">
+ <h3><?php echo $vars['entity']->title; ?></h3>
+ <p>
+ <?php
+
+ echo nl2br($vars['entity']->description);
+
+ ?>
+ </p>
+ <p>
+ <?php
+
+ echo $vars['entity']->tags;
+
+ ?>
+ </p>
+ </div>
+
+<?php
+
+ }
+
+?>
\ No newline at end of file |