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).

Comments

  • 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
  • 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.
  • 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
  • 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?
  • 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
  • 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.