Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[help] tweaking discussion.php for new theme

edited June 2009 in Vanilla 1.0 Help
Okay all you add-on and tweaking geniuses HELP!!!!! Creating a new theme, I've copied the discussion.php into my new theme folder to extend it. Here's what I have so far <li class="DiscussionTopic"> <span>'.$this->Context->GetDefinition('DiscussionTopic').'</span><a href="'.$UnreadUrl.'">'.$Discussion->Name.'</a> </li> <li class="DiscussionContent"> <span>'.$Discussion->Comment.'</a> </li> now ... what I want to do is extract the FIRST comment and display it where I have $Discussion->Comment of course $Discussion->Comment doesn't work it returns 0 - given this is only used on comment creation. I've looked over the RSS2 default page becuase the RSS feed does exactly what I want ... but it has it's own set of functions to do the joins for the discussion manager. I'm trying to write this as a theme rather than an extension ... am I hitting a brick wall? Is there anyway on the discussions page to reveal the comment associated with the discussion ... without me hacking the Vanilla.class.dis...files - which I don't want to go anywhere near!! Any thoughts?


  • $Discussion->Comment is an object I think. You should try $Discussion->Comment->Body. But I do think you need to change te discussion retrievel statement, because it doesn't load the first comment object... If you don't want to hack, you can use the delegates to do it.
  • $discussion->comment always returns 0 .... I'm pretty sure I have to change the retrievel statement .... delegates you say? ...hmmm okay cool ... off to look up info on them Cheers
  • edited July 2006
    okay I have it working ... but it meant hacking around in the discussionManager to add the following: // Get first comment body $s->AddJoin('Comment', 'tcb', 'CommentID', 't', 'FirstCommentID', 'left join'); $s->AddSelect('Body', 'tcb', 'CommentBody'); And then adding a few var setups etc in the vanilla.class.discussion file ... eg: $this->CommentBody = @$DataSet['CommentBody']; NOT the best way to do this ... but it works beautifully ... now I just call - $Discussion->CommentBody - and I have the first comment returned here it is working on my test setup ...
  • edited July 2006
    Are you telling me you built a time machine blog out of a Delorean Vanilla?
  • edited July 2006
    Yeap :) ... cool or crazy?
  • You just sinking all posts by default?
  • no ... but probably should look at that ey ...
  • SheilaSheila ✭✭
    Hi! This discussion seemed to have appropriate title so instead of starting a new one...

    I have few modifications I want make to discussion.php, first of them most likely dead simple second two well... let's hear :)

    Firstly, I wanna link the topic title back to that discussion. Like in this thread, category name 'Vanilla' is a link but '[help] tweaking discussion.php for new theme' is not. I get the idea and spent serious time yesterday playing with the template but since I'm not a coder, all I got was WSOD always with different versions. Drives me crazy clicking all the time title that is not a link :D

    Other things are to have 'Top of Page' link to every comment next to permalink and reply box to every page as a default. Having reply box now with plugin but since my add-on section is getting quite crowded already.. which are the line numbers in a source I should look for and is there any risk doing these modifications? (Other than WSOD if not getting it right first time).

    And disclaimer since I've seen replys to feature requests saying "Why use Vanilla then if u wanna all the bells and whistles". My reason is that since i've tested and used almost all the most popular stable forum softwares, open source and commercial, I ended up with Vanilla because of it's beautiful out of the box simplicity.
    Especially with a hobby project, I love spending time with adding and building features, rather than starting with stripping them out. Not to mention my allergy to tables. Even PunBB 1.3 is now very similar to other big one's, it still claims it's simple, I claim it's not and would be a nightmare to css it.
Sign In or Register to comment.