Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Meta Blog functionality, but LOCAL, is it possible?

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

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

Page: 1
Go to End
Author Topic: 943 Views
  • radu
    Avatar
    Community Member
    3 Posts

    Meta Blog functionality, but LOCAL, is it possible? Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Meta Blog functionality, but LOCAL, is it possible? Link to this post

    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) %>

  • radu
    Avatar
    Community Member
    3 Posts

    Re: Meta Blog functionality, but LOCAL, is it possible? Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Meta Blog functionality, but LOCAL, is it possible? Link to this post

    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

    943 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.