Can i extend with *_parent class FrontendController?


#1

Hello! I have question like in title of this post:
Can i extend with *_parent class FrontendController?

If not… how can i initiate some logic/data into all controllers from module?

Thanks


#2

You can not extend all controllers with one single entry in metadata.php
You have to extend some other calss that is available everywhere you need it, like oxViewConfig or one of the oxcmp classes


#3

But if i need also pass some data to “aView” in each controller? can I do this from viewConfig?

Second thing is that ViewConfig is not execute any code while it is creating. It’s only somekind of data handler. I need execute code in all controllers soo i have to extend all controllers and add in init method the same code everywhere.

Problem is that i don’t want to extend all controllers. But probably i don’t have choice.


#4

what kind of code is this? probably a widget can do waht you need


#5

no i can not put this into widget.

This code has influence on loading of content in ArticleList in ArticleListController. Widgets executes to late, I mean after model createing proccess.


#6

Then you could probably extend ArticleList.


#7

Probably your are right but is model the right place to check session with some variable and depends on it loads specific data into ArticleList?


#8

sound like you are doing something similar to the attribute filter. It stores the selected values in session and ArticleList uses it for loading data.


#9

yes it is very similar


#10

If you mean the usual article list, this is present in only few controllers. If you want to display a special article list on every page, a widget woud be fine. A widget is not too late in the process because a widget uses its own controller and therefore its own article list.