PHP code example of melisplatform / melis-demo-cms

1. Go to this page and download the library: Download melisplatform/melis-demo-cms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

melisplatform / melis-demo-cms example snippets


<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>

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

        $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.
        

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

    $this->SiteConfig('key');
    

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

    $config = $this->SiteConfig('key', 'allSites');
    // Returns the key from the allSites section of the config
    

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

    $text = $this->SiteTranslation('key', 1, 1);
    // Retrieves the translation for the language id 1 and site id 1.