Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorMr K
    • CommentTimeJul 13th 2006 edited
     # 1
    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?
    •  
      CommentAuthorJazzman
    • CommentTimeJul 13th 2006
     # 2
    $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.
    • CommentAuthorMr K
    • CommentTimeJul 13th 2006
     # 3
    $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
    • CommentAuthorMr K
    • CommentTimeJul 13th 2006 edited
     # 4
    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 ... http://studiowhiz.com/blog/
    •  
      CommentAuthorBergamot
    • CommentTimeJul 13th 2006 edited
     # 5
    Are you telling me you built a time machine blog out of a Delorean Vanilla?
    • CommentAuthorMr K
    • CommentTimeJul 13th 2006 edited
     # 6
    Yeap :) ... cool or crazy?
    •  
      CommentAuthorBergamot
    • CommentTimeJul 13th 2006
     # 7
    You just sinking all posts by default?
    • CommentAuthorMr K
    • CommentTimeJul 13th 2006
     # 8
    no ... but probably should look at that ey ...
Add your comments
    Username Password
  • Format comments as