public static function getComponentByPageId($component, $page_id)
    {
        $page_id = (int)$page_id;
        $component = sql_prepare($component);

        $cache_key = 'components_' . $page_id . '_c_' . $component;
        $res = NULL;

        if (Settings::isCacheEnabled()) {
            $res = Cacher::getInstance()->getDefaultCacher()->get($cache_key);

            // Set from cache
            if ($res) {
                return $res;
            }
        }

        // Get from DB
        $res = NULL;
        /** @var PageComponentHistory $page */
        $page = PageComponentEntityRepository::findOneEntityByCriteria([
            'page_id' => $page_id,
            'component' => $component
        ]);

        if ($page) {
            $res = $page->getData();
        }

        // Save to cache
        if (Settings::isCacheEnabled()) {
            Cacher::getInstance()->getDefaultCacher()->set($cache_key, $res);
        }

        return $res;
    }
public static function getComponentByPageId($component, $page_id)
    {
        $page_id = (int)$page_id;
        $component = sql_prepare($component);

        $cache_key = 'components_' . $page_id . '_c_' . $component;
        $res = NULL;

        if (Settings::isCacheEnabled()) {
            $res = Cacher::getInstance()->getDefaultCacher()->get($cache_key);

            // Set from cache
            if ($res) {
                return $res;
            }
        }

        // Get from DB
        $res = NULL;
        /** @var PageComponentHistory $page */
        $page = PageComponentEntityRepository::findOneEntityByCriteria([
            'page_id' => $page_id,
            'component' => $component
        ]);

        if ($page) {
            $res = $page->getData();
        }

        // Save to cache
        if (Settings::isCacheEnabled()) {
            Cacher::getInstance()->getDefaultCacher()->set($cache_key, $res);
        }

        return $res;
    }
public static function getComponentByPageId ( $ component , $ page_id ) { $ page_id = ( int ) $ page_id ; $ component = sql_prepare ( $ component ) ; $ cache_key = 'components_' . $ page_id . '_c_' . $ component ; $ res = NULL ; if ( Settings :: isCacheEnabled ( ) ) { $ res = Cacher :: getInstance ( ) -> getDefaultCacher ( ) -> get ( $ cache_key ) ; // Set from cache if ( $ res ) { return $ res ; } } // Get from DB $ res = NULL ; /** @var PageComponentHistory $page */ $ page = PageComponentEntityRepository :: findOneEntityByCriteria ( [ 'page_id' => $ page_id , 'component' => $ component ] ) ; if ( $ page ) { $ res = $ page -> getData ( ) ; } // Save to cache if ( Settings :: isCacheEnabled ( ) ) { Cacher :: getInstance ( ) -> getDefaultCacher ( ) -> set ( $ cache_key , $ res ) ; } return $ res ; }
Get one component data by page id and name
@param $component
@param $page_id
@return string
Get one component data by page id and name