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.

How do I pull a discussion from Vanilla 2 to another page?

edited April 2010 in Vanilla 2.0 - 2.8
I want to import a vanilla discussion to my apps text page, so users can read and comment. Is there any way to do this? is it through a hook? or do I need to copy vanilla app code to my app?


  • NickENickE New
    edited April 2010
    Here's an example of how you could get the first 10 discussions from an independent script. There might be a better way to do this, but it seems to work alright.

    define('APPLICATION', 'Garden');
    define('APPLICATION_VERSION', '1.0');

    define('PATH_ROOT', dirname(__FILE__) /* or wherever garden's installed */);




    $Discussion = new Gdn_DiscussionModel();
    $Sql = $Discussion->Get(0, 10); /* first ten discussions */

    while (($Row = $Sql->NextRow()) !== false) {
    echo '<strong>'.$Row->Name.'</strong> by '.$Row->FirstName.' ('.substr(htmlspecialchars($Row->FirstComment), 0, 20).')<br />';

    ...and with some copypasta and hacksauce you could probably get what you're after.
Sign In or Register to comment.