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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Meta Blog functionality, but LOCAL, is it possible?


Go to End


4 Posts   1292 Views

Avatar
radu

Community Member, 3 Posts

23 November 2008 at 8:23am

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

Forum Moderator, 5523 Posts

24 November 2008 at 6:43pm

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

Community Member, 3 Posts

24 November 2008 at 8:06pm

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

Forum Moderator, 5523 Posts

24 November 2008 at 8:46pm

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