Results 1 to 3 of 3

Thread: findFirstPublishedRoot ! Contao 3

  1. #1

    Default 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?
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default 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?
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

  3. #3

    Default 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();
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •