Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 2015

Joomla! 4.x Coding • How to load an extra model in a view?

$
0
0
Hi,

I created a component with a view called e.g. "MyView" and associated default model "MyViewModel.php". In "MyView/HtmlView.php" I want to load the default model and also an extra additional model called "MyView2Model.php".

Doing

Code:

$model1 = $this->getModel('MyView');  
works and creates an object. Loading the second model

Code:

$model2 = $this->getModel('MyView2');
gives NULL. Any idea what is wrong? I assume all the paths and naming conventions are correct. If I rename the second model to "MyView" and change the name of the class accordingly than the model loads flawlessly.

Doe it mean that I can use only one model per view?

Thanks!

Statistics: Posted by JanoD — Mon Nov 04, 2024 7:26 pm



Viewing all articles
Browse latest Browse all 2015

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>