Results 1 to 3 of 3

Thread: Root page id from dca

  1. #1
    New user
    Join Date
    10-15-18.
    Posts
    8

    Default Root page id from dca

    Hello,
    just a simple question, is there a better way to get root page id from dca plugin that fetching it step by step from database:

    PHP Code:
    $pid $dca->activeRecord ->pid;

    do
    {
        
    $objPage $this ->Database ->prepare("SELECT id,pid FROM tl_page WHERE id=?")
                               ->
    limit(1)
                               ->
    execute($pid);
        
        if ( 
    $objPage->numRows )
        {
            break;
        }
        
    $rootId $objPage->id;
        
    $pid $objPage->pid;
    }
    while ( 
    $pid && $objPage->type != 'root' ); 
    maybe it is already stored somewhere...? thanks

  2. #2
    User
    Join Date
    06-19-09.
    Posts
    326

    Default

    are you talking about frontend or backend?

    in backend you can use findPublishedRootPages from PagesModel class

    in frontend you can use getRootPageFromUrl from Frontend class
    Consulenza Contao CMS https://www.intco.it

  3. #3

    Default

    Hi there,

    I am also looking for the same way to find the root page to which the current Content Element associated in Backend.

    \PageModel::findPublishedRootPages(); will give you all the published root pages, but there is no way to find, to which root the content element in the backend it attached.

    Is there a better way?
    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
  •