Adding block to every template

Hi all !
I am facing quite a problem here. I’m currently creating a module for oxid and I’d like to add a js block to every page.
I already created a block in the[I] /views/block[/I] directory and declared it in the [I]metadata.php[/I].
The problem is that the content of the variables of the block will depend on the content of the page.
At first I wanted to extend oxView or oxUBase so I would not have to create a controller for each page. Yet those controllers cannot be extended… So I’m stuck ! :frowning:
Does someone know how I could do that ?
I don’t know if I’m making myself clear so if you have any question, just ask :wink:

Thanks !

oxviewconfig can be extended.

I thought of extending this class, but I was wondering if there was another way. Thanks !

There is another way, you can write a component (oxcmp…), but a custom component needs to be registered manually in config.inc.php as far as i know, so this makes installation of the module more complicated.

Well that would make the installation of the module a bit more complicated indeed.
I’m trying to figure out how to make it work by extending oxviewconfig. Yet I have another problem : since the content of the module varies according the page being displayed, is there a way to know which page it is (ie. homepage or payment page etc…) ?
Thanks !! :slight_smile:

The controller (alist, payment etc) has a method getClassName(), which can be accessed from template ($oView->getClassName()) or you can get the current controller name in oxviewconfig with getActiveClassName method.