Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Meta Blog functionality, but LOCAL, is it possible?


Reply

4 Posts   953 Views

Avatar
radu

23 November 2008 at 8:23am Community Member, 3 Posts

I need to setup a page that will show me a selection of all blog posts tagged with a certain tag, let's say "mytag"

I could do it with a redirector, but then the URL changes to /blog/tag/mytag

What I need is a Meta Blog functionality that will show blogs tagged on my site, not on Technorati.

Any ideas?

Avatar
Willr

24 November 2008 at 6:43pm Forum Moderator, 5511 Posts

Well all you need is a function which returns a set of blogs with a given 'tag' so its fairly straight forward. Im pretty sure this will work for you. Its pretty crude. I better way would be to have an exact match search rather then a LIKE.

function ArticlesByTag($tag) {
return DataObject::get("BlogEntry", "Tags LIKE '$tag'");

Then in your template you can do <% control ArticlesByTag(SomeTag) %>

Avatar
radu

24 November 2008 at 8:06pm Community Member, 3 Posts

Great stuff willr, I guess it's the first step towards getting dirty with the internals.
I will look up the documentation on how to do that kind of hacking in order to preserve the hack through upgrades.
I appreciate the help, keep up the good work.

Avatar
Willr

24 November 2008 at 8:46pm Forum Moderator, 5511 Posts

This is not a hack at all. If you put this in your mysite/code/Page.php it will not be effected by any upgraded. You can even override the default blog template for your own by creating a folder in themes/ called 'yourtheme_blog' with the same folder / file structure as blog/ (but without code). This keeps all your code modular and free from any upgrade issues