Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Category descriptions in sidebar

I'd like to put by category descriptions in the sidebar. It looks like I can't use PHP in the messages - so what would be the best/recommended way to do this? I don't see any way to manage the sidebar or anything there other than messages.


  • Options
    R_JR_J Ex-Fanboy Munich Admin

    The blocks in the sidebar are called "Module" in Vanilla-Speak. Here's something I've written down few weeks ago:

  • Options

    Geesh. Even as a non-programmer I can usually pick up a web software's template and figure out what needs to edited to add custom elements to a theme. Vanilla has just about the most non-friendly code I've ever seen. I'm just trying to figure out how to add text to a sidebar and it's so confusing.

    I managed to manipulate the ForumDonate module, using some bits and pieces of code elsewhere on the forum to get the description in the sidebar, but good lord I can't just get the title of the category in there now.

      return $this->_Sender->Category->Description;

    Gets me the description.

      return $this->_Sender->Category->Name;

    Gets me the Category name.

    But I can't seem to get them to both show at the same time. :/

  • Options
    hgtonighthgtonight ∞ · New Moderator


    Modules in Vanilla override the ToString() method. This method must return a string.

    The key is that you are trying to return twice. In PHP (and every other language I am familiar with), execution of a block of code will stop after the first executed return statement. You are looking to concatenate two strings and return the result.

    Try something like this in your ToString() method:

    public function ToString() {
      $CatName = $this->_Sender->Category->Name;
      $CatDesc = $this->_Sender->Category->Description;
      return $CatName . ' ' . $CatDesc;

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.