PHP code example of heimrichhannot / contao-haste_plus

1. Go to this page and download the library: Download heimrichhannot/contao-haste_plus 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/ */

    

heimrichhannot / contao-haste_plus example snippets


// MyClass.php

public function getSelectOptions(array $arrNewsArchives)
{
	// select a unique key
	$strCacheKey = 'my_select_options' . implode('_', $arrNewsArchives);
	
	if(FileCache::getInstance()->isExisting($strCacheKey))
	{
		return FileCache::getInstance()->get($strCacheKey);
	}
	
	$arrItems = array();
	
	// heavy sql queries or http-requests (just an example)
	$objItems = \NewsModel::findPublishedByPids($arrNewsArchives);
	
	if($objItems === null)
	{
		return $arrItems;
	}
	
	$arrItems = $objItems->fetchEach('headline');
	
	FileCache::getInstance()->set($strCacheKey, $arrItems);
  
	return $arrItems;
}


# news_full.html5
 $objMap = new \HeimrichHannot\Haste\Map\GoogleMap();