concrete/src/Page/Page.php
public static function getByPath($path, $version = 'RECENT', TreeInterface $tree = null)
    {
        $path = rtrim($path, '/'); // if the path ends in a / remove it.
        $cache = \Core::make('cache/request');

        if ($tree) {
            $item = $cache->getItem(sprintf('site/page/path/%s/%s', $tree->getSiteTreeID(), trim($path, '/')));
            $cID = $item->get();
            if ($item->isMiss()) {
                $db = Database::connection();
                $cID = $db->fetchColumn('select Pages.cID from PagePaths inner join Pages on Pages.cID = PagePaths.cID where cPath = ? and siteTreeID = ?', [$path, $tree->getSiteTreeID()]);
                $cache->save($item->set($cID));
            }
        } else {
            $item = $cache->getItem(sprintf('page/path/%s', trim($path, '/')));
            $cID = $item->get();
            if ($item->isMiss()) {
                $db = Database::connection();
                $cID = $db->fetchColumn('select cID from PagePaths where cPath = ?', [$path]);
                $cache->save($item->set($cID));
            }
        }

        return self::getByID($cID, $version);
    }
public static function getByPath($path, $version = 'RECENT', TreeInterface $tree = null)
    {
        $path = rtrim($path, '/'); // if the path ends in a / remove it.
        $cache = \Core::make('cache/request');

        if ($tree) {
            $item = $cache->getItem(sprintf('site/page/path/%s/%s', $tree->getSiteTreeID(), trim($path, '/')));
            $cID = $item->get();
            if ($item->isMiss()) {
                $db = Database::connection();
                $cID = $db->fetchColumn('select Pages.cID from PagePaths inner join Pages on Pages.cID = PagePaths.cID where cPath = ? and siteTreeID = ?', [$path, $tree->getSiteTreeID()]);
                $cache->save($item->set($cID));
            }
        } else {
            $item = $cache->getItem(sprintf('page/path/%s', trim($path, '/')));
            $cID = $item->get();
            if ($item->isMiss()) {
                $db = Database::connection();
                $cID = $db->fetchColumn('select cID from PagePaths where cPath = ?', [$path]);
                $cache->save($item->set($cID));
            }
        }

        return self::getByID($cID, $version);
    }
public static function getByPath ( $ path , $ version = 'RECENT' , TreeInterface $ tree = null ) { $ path = rtrim ( $ path , '/' ) ; // if the path ends in a / remove it. $ cache = \ Core :: make ( 'cache/request' ) ; if ( $ tree ) { $ item = $ cache -> getItem ( sprintf ( 'site/page/path/%s/%s' , $ tree -> getSiteTreeID ( ) , trim ( $ path , '/' ) ) ) ; $ cID = $ item -> get ( ) ; if ( $ item -> isMiss ( ) ) { $ db = Database :: connection ( ) ; $ cID = $ db -> fetchColumn ( 'select Pages.cID from PagePaths inner join Pages on Pages.cID = PagePaths.cID where cPath = ? and siteTreeID = ?' , [ $ path , $ tree -> getSiteTreeID ( ) ] ) ; $ cache -> save ( $ item -> set ( $ cID ) ) ; } } else { $ item = $ cache -> getItem ( sprintf ( 'page/path/%s' , trim ( $ path , '/' ) ) ) ; $ cID = $ item -> get ( ) ; if ( $ item -> isMiss ( ) ) { $ db = Database :: connection ( ) ; $ cID = $ db -> fetchColumn ( 'select cID from PagePaths where cPath = ?' , [ $ path ] ) ; $ cache -> save ( $ item -> set ( $ cID ) ) ; } } return self :: getByID ( $ cID , $ version ) ; }
Get a page given its path.

@param string $path the page path (example: /path/to/page)
@param string $version the page version ('RECENT' for the most recent version, 'ACTIVE' for the currently published version, 'SCHEDULED' for the currently scheduled version, or an integer to retrieve a specific version ID)
@param \Concrete\Core\Site\Tree\TreeInterface|null $tree

@return \Concrete\Core\Page\Page
Get a page given its path .