Module Extend View Class

Hi there,

I had a question and I can’t seem to find any solution for it… I was recently working on a module and it is actually working fine, but in the moment I have something like this


'oxarticlelist' 		=> 'x_module/core/x_module_articlelist',
'start' 			=> 'x_module/views/x_module_content', 
'alist' 			=> 'x_module/views/x_module_content', 
'details' 			=> 'x_module/views/x_module_content', 
'tag' 				=> 'x_module/views/x_module_content', 
'search' 			=> 'x_module/views/x_module_content', 
'compare' 			=> 'x_module/views/x_module_content', 
'manufacturerlist'	=> 'x_module/views/x_module_content',	

as you can see I have extended almost most all page classes, I would like to simplify that, like extending one class…

is there a way to accomplish this?

I tried doing this by extending “oxview”, but I receive an error saying my function does not exist…

'oxarticlelist'	=> 'x_module/core/x_module_articlelist',
'oxview' 		 	=> 'x_module/views/x_module_content', 

any help is appreciated

edit: or if anyone could tell me how to make your class in every page available would help aswell thnx :slight_smile:

[QUOTE=Eternity_;95371]or if anyone could tell me how to make your class in every page available would help aswell thnx :)[/QUOTE]

extend oxcmp_utils

hi jschindler… thnx for the reply

how do you call this extended function then in smarty

[{ $oView->myFunction() }] wont do anything neither does the following
$oxcmp->myFunction()
$oxcmp_utils->myFunction()

Sorry, forgot to mention that oxcmp_utils does not have an own render method, you need to implement it in your extended class.

public function render() { return $this; }

does the job. Then you can access your functions with

[{ $oxcmp_utils->myFunction() }]

[QUOTE=Eternity_;95395]hi jschindler… thnx for the reply

how do you call this extended function then in smarty

[{ $oView->myFunction() }] wont do anything neither does the following
$oxcmp->myFunction()
$oxcmp_utils->myFunction()[/QUOTE]

Hey thnx for coming back, gonna try it out right away… thnx ^^

edit: heyy!.. Thnx a lot it worked withouth any trouble ^^

how do you call this extended function then in smarty

[{ $oView->myFunction() }] wont do anything neither does the following
$oxcmp->myFunction()
$oxcmp_utils->myFunction()

did you add render() to oxcmp_utils?