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.

how to use categoryList delegate?

edited June 2008 in Vanilla 1.0 Help
i'm trying to write a plugin that will add some text to the categoryGird(preferably just after Discussions, Options), but i don't really know how to use the categoryList delegate, i tried the following:

function CategoryGridView_Add(&$CategoryList) { $CategoryList .= '<li class=CategoryView"><span>stuff</span>100</li>'; } $Context->AddToDelegate("CategoryList"," ","CategoryGridView_add");

however the text doesn't get added to categoryGrid, does anyone know how to do it? (i don't want to do the nasty way - customize the themes/categories.php file).


  • Options
    maybe I'm wrong, but it seems you're missing a parameter on the AddToDelegate function:
    1 - the name of the control which has the delegate you want to attach your function to
    2 - the actual name of the delegate
    3 - the name of the function you want to attach to the delegate
  • Options
    i was missing the second argument is because i can't find any delegate for categorylist(onley PreRender and PostRender available for CategoryList). as far as i can see i will need to modify /thme/categories.php to put something in the categorygrid.
  • Options
    You can only inject your own code where there are CallDelegate() methods placed in the Vanilla source code. Leaving that second parameter as a space would tell Vanilla to execute your code when the " " delegate is called.

    Since there are no delegates in the themes/categories.php theme file, you will need to request a delegate (recommended) or make a new theme file (easiest).

    Delegation Documentation
  • Options
    i think i will just modify the themes/categories.php file, since its the easiest way. but request a delegate will be a good idea, since there might be some other poeple want to customized their categorygrid. by the wya how do i request a delegate?
  • Options
    it's adviseable not to modify the default vanilla theme so, just, as suggested in the documentation, create a new theme just with this modified file you need
  • Options
    Where do you want the code inserted? I'll put this in as a request for a new delegate, then you can upgrade just the theme file to use yourself, and it will be available in the next version for everybody else.
This discussion has been closed.