Empathy MVC

ELib Siteinfo

System requirements

  • PHP 5.3
  • Memcached

Setup

Follow all the instructions in the elib-base guide but using the following composer config:

{
    "require": {
        "mikejw/elib-siteinfo": "0.1"

    },
    "minimum-stability": "dev"
}

Application

Make sure Redbean is added to the list of plugins in ./config.yml

-
  name: Redbean
  version: 1.0

Enable the cache in ./application/CustomController.php (in the constructor):

$cache_enabled = true;
$cache = new \Empathy\ELib\VCache('127.0.0.1', 11211, null, $cache_enabled);
$this->stash->store('cache', $cache);

Also enable automatic fetching of site settings in the same block of code:

$info = $cache->cachedCallback('site_info', array('\Empathy\ELib\Settings\SiteInfo', 'getAll'));
$this->assign('site_info', $info);
$this->stash->store('site_info', $info);

You will then be able to include the following template files into your header template as long as the controller extends Empathy\ELib\EController.

{include file="elib://comp_title.tpl"}
{include file="elib://comp_keywords.tpl"}
{include file="elib://comp_description.tpl"}

Backend

Settings can be added at http://localhost/infotest/public_html/admin/settings. These will be cached. The cache can be cleared by clicking on the cache button and then on clear.

 

Comments