本文整理匯總了PHP中Sections::get_vhost方法的典型用法代碼示例。如果您正苦於以下問題:PHP Sections::get_vhost方法的具體用法?PHP Sections::get_vhost怎麽用?PHP Sections::get_vhost使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sections
的用法示例。
在下文中一共展示了Sections::get_vhost方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_permalink
/**
* get permanent address
*
* @param array page attributes
* @return string the permanent web address to this item, relative to the installation path
*/
public static function get_permalink($item)
{
global $context;
// sanity check
if (!isset($item['id'])) {
throw new Exception('bad input parameter');
}
// get host to this page
$vhost = Sections::get_vhost('section:' . $item['id']);
// if top-level section with bounded vhost, provide a root link
if ((!isset($item['anchor']) || !$item['anchor']) && file_exists($context['path_to_root'] . 'parameters/virtual_' . $item['nick_name'] . '.include.php')) {
return $vhost;
}
// absolute link
return $vhost . Sections::get_url($item['id'], 'view', $item['title'], isset($item['nick_name']) ? $item['nick_name'] : '');
}
示例2: get_permalink
/**
* get permanent address
*
* @param array page attributes
* @return string the permanent web address to this item, relative to the installation path
*/
public static function get_permalink($item)
{
global $context;
// sanity check
if (!isset($item['id'])) {
return null;
}
// get host to this page
$vhost = Sections::get_vhost($item['anchor']);
// absolute link
return $vhost . Articles::get_url($item['id'], 'view', $item['title'], isset($item['nick_name']) ? $item['nick_name'] : '');
}