Not signed in (Sign In)

Categories

Vanilla 1.1.5 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.
    • CommentAuthorSirNot
    • CommentTimeAug 22nd 2008 edited
     # 1
    I was editing this and found the following code, used in updating the panel: $DiscussionID = ForceIncomingInt("DiscussionID", "0");
    if ($DiscussionID > 0)
    {
    $result = mysql_query("SELECT CategoryID FROM ...",$Context->Database->Connection);
    $row = mysql_fetch_row($result);
    $CategoryID = $row[0];
    }
    else
    $CategoryID = ForceIncomingInt('CategoryID',0);

    this adds a wholly unnecessary sql query to every comments page load. a more efficient way to get that info is to simply wait until it's been loaded into $CommentGrid by putting all the panel updating in a delegate (eg. $Context->AddToDelegate('Head', 'PreRender', 'PanelUpdateFunction');) once you do that you get ditch the mysql query:if($Context->SelfUrl == 'comments.php' && $GLOBALS['CommentGrid']->Discussion)
    {
    $CategoryID = $GLOBALS['CommentGrid']->Discussion->CategoryID;
    $Category = $GLOBALS['CommentGrid']->Discussion->Category;
    $DiscussionID = $GLOBALS['CommentGrid']->Discussion->DiscussionID;
    }
    else if($Context->SelfUrl == 'index.php' && $GLOBALS['DiscussionGrid']->Category)
    {
    $CategoryID = $GLOBALS['DiscussionGrid']->Category->CategoryID;
    $Category = $GLOBALS['DiscussionGrid']->Category->Name;
    }
    else $CategoryID = $DiscussionID = 0;

    er yeah, just thought I'd throw that out there. if you wanted you could also combine the queries from you CheckNotify calls, but you're probably not as obsessive as I am.
Add your comments
    Username Password
  • Format comments as