本文整理汇总了PHP中eZSiteAccess::saNameByLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSiteAccess::saNameByLanguage方法的具体用法?PHP eZSiteAccess::saNameByLanguage怎么用?PHP eZSiteAccess::saNameByLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSiteAccess
的用法示例。
在下文中一共展示了eZSiteAccess::saNameByLanguage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
//.........这里部分代码省略.........
$pageData['canonical_url'] = false;
$pageData['canonical_language_url'] = false;
// is_edit if not on user/edit and not on content/action when
// you get info collector warning about missing attributes
if ( $uiContext === 'edit'
&& strpos( $uriString, 'user/edit' ) === false
&& ( empty( $contentInfo ) || strpos( $uriString, 'content/action' ) === false ) )
{
$pageData['is_edit'] = true;
}
if ( isset( $contentInfo['viewmode'] ) )
{
$viewMode = $contentInfo['viewmode'];
}
else
{
$viewMode = '';
}
// canonical url, to let search engines know about main location on content with multiple locations
if ( isset( $parameters['canonical_url'] ) )
{
$pageData['canonical_url'] = $parameters['canonical_url'];
}
elseif ( isset( $contentInfo['main_node_url_alias'] ) && $contentInfo['main_node_url_alias'] )
{
$pageData['canonical_url'] = $contentInfo['main_node_url_alias'];
}
elseif ( isset( $contentInfo['current_language'] )
&& $contentInfo['current_language'] !== $ini->variable( 'RegionalSettings', 'ContentObjectLocale' ) )
{
$siteaccess = eZSiteAccess::saNameByLanguage( $contentInfo['current_language'] );
if ( $siteaccess !== null )
{
$lang = eZContentLanguage::fetchByLocale( $ini->variable( 'RegionalSettings', 'ContentObjectLocale' ) );
if ( ( $contentInfo['language_mask'] & $lang->attribute('id') ) < 1 )
{
$handlerOptions = new ezpExtensionOptions();
$handlerOptions->iniFile = 'site.ini';
$handlerOptions->iniSection = 'RegionalSettings';
$handlerOptions->iniVariable = 'LanguageSwitcherClass';
$handlerOptions->handlerParams = array( array( 'Parameters' => array( 'sa', $currentNodeId ),
'UserParameters' => array() ) );
$langSwitch = eZExtension::getHandlerClass( $handlerOptions );
$langSwitch->setDestinationSiteAccess( $siteaccess );
$langSwitch->process();
$pageData['canonical_language_url'] = $langSwitch->destinationUrl();
}
}
}
/*
RootNodeDepth is a setting for letting you have a very simple multisite, single database and singe siteaccess setup.
The content of the menues will be the same on all system pages like user/login, content/edit
and so on, and also when you surf bellow the defined page_root_depth.
The sites will also share siteaccess and thus also the same ez publish design and templates.
You can however custimize the design with css using the class on div#page html output:
subtree_level_x_node_id_y class
Note: It is recommended to turn it of by setting it to 0 for normal sites!
Example having 2 or more 'sub-sites' with RootNodeDepth=2:
root (menu shows sub sites as menu choices like it will on system pages)