findFirstPublishedRoot ! Contao 3
In contao 3 PageModel, there is not method to find a first published root. Only nearest is. \PageModel::findFirstPublishedRootByHostAndLanguag e(string $strHost, mixed $varLanguage, array $arrOptions);
which needs few parameters
So I've to do like:
Code:
$objFirstPublishedRoot = $this->Database->prepare("SELECT id, language FROM tl_page WHERE pid=0 AND published=1 ORDER BY sorting")->execute()->limit(1);
Is there a better way?
Re: findFirstPublishedRoot ! Contao 3
Try to search in your Contao files for 'findFirstPublishedRootByHostAndLanguage'
In Frontend.php line 315 you find this
$objRootPage = \PageModel::findFirstPublishedRootByHostAndLanguag e($host, \Input::get('language'));
Did you try that?
Re: findFirstPublishedRoot ! Contao 3
the method: findFirstPublishedRootByHostAndLanguage is there as I've found it already. But what I'm looking for is, without having to pass the parameters like $host, $language, get to the first published root. Something like \PageModel::findFirstPublishedRoot();