Thứ Bảy, 20 tháng 7, 2013

Replace Item ID

$url= ContentHelperRoute::getArticleRoute($item->slug, $item->catslug);
$query = explode('?', $url); // Split the URL on `?` to get the query string
parse_str($query[1], $data); // Parse the query string into an array

//echo $data['Itemid']; // 292

$newValue = $params['Item_Id'];
$data['Itemid'] = $newValue; // Replace item_id's value
$url = $query[0].'?'.http_build_query($data); // rebuild URL

$item->article_link=JRoute::_($url);

0 nhận xét:

Đăng nhận xét