Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 12

6apxatCurtisOdenericgillettelortabacx00 +7 guests

how to use categoryList delegate?

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

  • Posts: 248
    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
  • Posts: 7
    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.
  • Posts: 408
    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
  • Posts: 7
    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?
  • Posts: 248
    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
  • Posts: 2,301
    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.