PHP code example of melisplatform / melis-front

1. Go to this page and download the library: Download melisplatform/melis-front 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-front example snippets


// Get the plugin
$showListForFolderPlugin = $this->MelisFrontShowListFromFolderPlugin();

// Add some parameters
$menuParameters = array(
    'template_path' => 'MelisDemoCms/plugin/testimonial-slider', // will list the subpages with a slider style template
    'pageIdFolder' => 2, // will list subpages of page 2
);

// render the view
$listView = $showListForFolderPlugin->render($menuParameters);

// Add the generated view as a child view by the name "testimonialList"
$this->view->addChild($listView, 'testimonialList');

// Get the plugin
$searchResults = $this->MelisFrontSearchResultsPlugin();

// Add some parameters
$searchParameters = array(
    'template_path' => 'MelisDemoCms/plugin/search-results', // template used
    'siteModuleName' => 'MelisDemoCms', // Site Index to search in
    'pagination' => array(  // pagination parameters
        'nbPerPage' => 10, 
        'nbPageBeforeAfter' => 3
    ),
);
// render the view
$searchView = $searchResults->render($searchParameters);

// Add the generated view as a child view by the name "searchresults"
$this->view->addChild($searchView, 'searchresults');

// Creation of a dragdropzone link to the pageId and with id "dragdropzone_zone_1"
echo $this->MelisDragDropZone($this->idPage, "dragdropzone_zone_1");

        $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');
    

// Creation of a dragdropzone link to the pageId and with id "dragdropzone_zone_1"
echo $this->MelisDragDropZone($this->idPage, "dragdropzone_zone_1");

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