當前位置: 首頁>>代碼示例>>PHP>>正文


PHP eZSiteAccess::saNameByLanguage方法代碼示例

本文整理匯總了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)
開發者ID:ezsystemstraining,項目名稱:ez54training,代碼行數:67,代碼來源:ezpagedata.php


注:本文中的eZSiteAccess::saNameByLanguage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。