melisplatform/melis-demo-cms

官方Melis平台演示网站

安装次数: 2,036

依赖项: 0

建议者: 0

安全性: 0

星标: 1

关注者: 7

分支: 0

开放问题: 0

语言:CSS

类型:melisplatform-module

v5.2.0 2024-06-06 08:09 UTC

README

这是一个演示网站,提供了如何使用Melis模块服务的示例。

开始使用

以下说明将帮助您在您的机器上运行项目副本。

虚拟主机配置

MELIS_MODULE变量(标识哪个网站将作为此域的前端加载)。
我们应该使用MelisDemoCms设置此变量
虚拟主机应如下所示

<VirtualHost *:80>
    DocumentRoot "PATH_DOCROOT/public"
    <Directory "PATH_DOCROOT/public">
        Options +Indexes +FollowSymLinks +ExecCGI
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
        AllowOverride All
        Require all granted
    </Directory>

    ServerName www.mysite.local:80
    SetEnv MELIS_PLATFORM "development"
    SetEnv MELIS_MODULE "MelisDemoCms"

</VirtualHost>

要求

  • composer/installers
  • php 7

当使用composer时,这将自动完成。

安装

运行composer命令

composer require melisplatform/melis-demo-cms

网站中使用的模块

  • Melis前端
  • Melis引擎
  • Melis CMS
  • Melis CMS幻灯片
  • Melis CMS潜在客户
  • Melis CMS新闻

服务

  • MelisSiteConfigService
    提供用于检索网站配置的服务。
    文件:/melis-front/src/Service/MelisSiteConfigService.php

    MelisFrontSiteConfigListener用于通过合并文件和数据库中的配置来更新网站的常规配置服务。

    • getSiteConfigByKey(key, section = 'sites', language = null)
      此函数通过键检索特定的配置。

      调用服务。

      $siteConfigSvc = $this->getServiceManager()->get('MelisSiteConfigService');
      

      要获取当前网站特定key和ID为1的页面的语言

      $siteConfigSvc = $this->getServiceManager()->get('MelisSiteConfigService');
      
      $config = $siteConfigSvc->getSiteConfigByKey('key', 1);
      

      但如果我们想从当前网站的另一种语言获取键怎么办?我们可以通过在获取配置的地方定义语言来实现这一点。

      $siteConfigSvc = $this->getServiceManager()->get('MelisSiteConfigService');
              
      $config = $siteConfigSvc->getSiteConfigByKey('key', 1,'sites', 'fr');
      // The language of the page is now overridden by the specified language.
      

      我们还可以通过使用site Id从另一个网站获取特定的key

      $siteConfigSvc = $this->getServiceManager()->get('MelisSiteConfigService');
      
      $config = $siteConfigSvc->getSiteConfigByKey('key', 1, 1);
      // Return all the values of the specified key from all languages from the site with id 1.
      // The expected output is an array of values from different languages
      
      $config = $siteConfigSvc->getSiteConfigByKey('key', 1, 1, 'fr');
      // Return all the values of the specified key for the French language from the site with id 1.
      

      除了网站外,还有一个不同的部分。目前,我们有两个部分,即网站和所有网站。

      $siteConfigSvc = $this->getServiceManager()->get('MelisSiteConfigService');
      
      $config = $siteConfigSvc->getSiteConfigByKey('key', 1, 'allSites');
      // Returns the key from the allSites section of the config
      // Language for the page is not applied but still used to get the site id and name to map for the config
      
  • MelisSiteTranslationService
    提供翻译文本和列出所有网站翻译的服务
    文件:/melis-front/src/Service/MelisSiteTranslationService.php

    • getText(translationKey, langId, siteId) .

      调用服务。

      $melisSiteTranslationSvc = $this->getServiceManager()->get('MelisSiteTranslationService');
      

      要获取特定翻译,您需要指定翻译键以及语言ID和网站ID。

      $test = $melisSiteTranslationService->getText('key', 1, 1);
      // Retrieves the translation for the language id 1 and site id 1.
      
  • 有关SEO、URL服务和模板插件,请参阅Melis前端的完整文档

  • 有关页面、树系统服务和引擎插件,请参阅Melis引擎的完整文档

  • 有关CMS插件(标签、基本页面元素)和服务,请参阅Melis CMS的完整文档

  • 有关CMS幻灯片插件和服务,请参阅Melis CMS幻灯片的完整文档

  • 有关CMS新闻插件(新闻列表、最新新闻和详细信息)和服务,请参阅Melis CMS新闻的完整文档

  • 有关CMS潜在客户插件(联系表单)和服务,请参阅Melis CMS潜在客户的完整文档

视图助手

Melis前端视图助手

  • MelisSiteConfigHelper
    此助手用于获取网站的特定配置。
    文件: /melis-front/src/View/Helper/MelisDragDropZoneHelper.php
    函数: SiteConfig(key, sectiom = 'sites', language = null)

    调用助手。

    $this->SiteConfig('key');
    

    获取当前站点的配置中的特定键

    $config = $this->SiteConfig('key');
    

    但如果我们想要从当前站点的另一个语言获取怎么办?我们可以通过定义获取配置的地方的语言来实现。

    $config = $this->SiteConfig('key', 'sites', 'fr');
    // The language of the page is now overridden by the specified language.
    

    我们还可以通过使用site Id从另一个网站获取特定的key

    $config = $this->SiteConfig('key', 1);
    // Return all the values of the specified key from all languages from the site with id 1.
    // The expected output is an array of values from different languages
    
    $config = $this->SiteConfig('key', 1, 'fr');
    // Return all the values of the specified key for the French language from the site with id 1.
    

    除了sites之外,还有不同的部分。目前,我们有sitesallSites两个部分。

    $config = $this->SiteConfig('key', 'allSites');
    // Returns the key from the allSites section of the config
    
  • MelisSiteTranslation
    此助手用于获取站点的特定翻译。
    文件: /melis-front/src/View/Helper/MelisSiteTranslationHelper.php
    函数: getText(translationkey, langId, siteId)

    调用助手方法。

    $this->SiteTranslation('translationKey', 'langId', 'siteId');
    

    要获取特定翻译,您需要指定翻译键以及语言ID和网站ID。

    $text = $this->SiteTranslation('key', 1, 1);
    // Retrieves the translation for the language id 1 and site id 1.
    
  • 有关更多Melis Front视图助手 请在此处查看Melis Front的完整文档

作者

还可以查看参与此项目的贡献者列表

许可证

本项目根据OSL-3.0许可证授权 - 请参阅LICENSE.md文件以获取详细信息。