PHP code example of socalnick / scn-esi-widget
1. Go to this page and download the library: Download socalnick/scn-esi-widget 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/ */
socalnick / scn-esi-widget example snippets
return array(
'modules' => array(
'Application',
'ScnEsiWidget',
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
);
public function esiAction()
{
$viewModel = new ViewModel();
$this->esiWidget()->addToViewModel($viewModel, '/application/index/recent-tweets', 'recentTweets');
$headers = $this->getResponse()->getHeaders();
$cacheControl = new \Zend\Http\Header\CacheControl();
$cacheControl->addDirective('s-maxage', '60');
$headers->addHeader($cacheControl);
return $viewModel;
}
public function recentTweetsAction()
{
$headers = $this->getResponse()->getHeaders();
$cacheControl = new \Zend\Http\Header\CacheControl();
$cacheControl->addDirective('s-maxage', '10');
$headers->addHeader($cacheControl);
$viewModel = new ViewModel();
$viewModel->setTerminal(true);
return $viewModel;
}
<div> echo $this->recentTweets
<ul>
<li> echo date('h:i:s')