Get URL segments in core php

//– META KEYWORDS:: –
    $XSHRMETA_REQUEST_URI_PATH = parse_url($_SERVER[‘REQUEST_URI’], PHP_URL_PATH);
    $XSHRMETA_URI_SEGMENTS     = explode(‘/’, $XSHRMETA_REQUEST_URI_PATH);
    //print_r( $XSHRMETA_URI_SEGMENTS);
    // FOR PRODUCT DETAILS META::
    if(isset($XSHRMETA_URI_SEGMENTS[2]) && $XSHRMETA_URI_SEGMENTS[2]==”product-details”){
        if(isset($XSHRMETA_URI_SEGMENTS[4]) && $XSHRMETA_URI_SEGMENTS[4] !=””){
            $XSHRMETA_PRODUCT_ID   = $XSHRMETA_URI_SEGMENTS[4];
            $META_DETAILS          = getsite_meta_keyword(“product-details” , $XSHRMETA_PRODUCT_ID);
            $SITE_META_DESCRIPTION = $META_DETAILS[‘DESCRIPTION’];
            $SITE_META_KEYWORDS    = $META_DETAILS[‘KEYWORD’];
}
}
//– META FUNCTION ENDS –
?>

Leave a Reply

Your email address will not be published. Required fields are marked *