aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/blog/start.php9
-rw-r--r--mod/blog/views/default/object/blog.php2
2 files changed, 10 insertions, 1 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php
index f8af95e17..d7157c40b 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -48,6 +48,8 @@
// Register a page handler, so we can have nice URLs
register_page_handler('blog','blog_page_handler');
+ // Register a URL handler for blog posts
+ register_entity_url_handler('blog_url','object','blog');
}
/**
@@ -82,6 +84,13 @@
}
+ function blog_url($blogpost) {
+
+ global $CONFIG;
+ return $CONFIG->url . "blog/" . $blogpost->getOwnerUser()->username . "/read/" . $blogpost->getGUID();
+
+ }
+
// Make sure the blog initialisation function is called on initialisation
register_event_handler('init','system','blog_init');
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index 52c03d23b..0317f952f 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -17,7 +17,7 @@
?>
<div class="blog-post">
- <h3><a href="<?php echo $vars['url']; ?>blog/<?php echo $vars['entity_owner']->username; ?>/read/<?php echo $vars['entity']->getGUID(); ?>"><?php echo $vars['entity']->title; ?></a></h3>
+ <h3><a href="<?php echo $vars['entity']->getURL(); ?>"><?php echo $vars['entity']->title; ?></a></h3>
<p class="strapline">
<span style="float:right">
<?php