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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   1520 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