File: D:/HostingSpaces/SBogers10/tops.komma.pro/wwwroot/lib/content/content_block.class.php
<?php
/**
* content_block.class.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 13/02/14
*/
class Content_Block
{
/*
* Block with rows - XML Object
* (f.e. "Article")
*/
protected $block;
// Language
protected $lang;
protected $urls;
/*
* Constructor
*/
public function __construct()
{
// Set language and url for conversion
$Translator = new Translator(URL_LANG);
$this->lang = $Translator->get();
$this->urls = $Translator->getUrls();
}
/*
* Generate content
* Check what blocks to generate
*/
public function generate()
{
// Output
$output = '';
$key = 0;
foreach($this->block->row as $row)
{
// Get values
$type = $row->attributes()->type;
if($row)
{
// generate method name
$methodName = str_replace('_',' ',$type);
$methodName = ucwords($methodName);
$methodName = 'get' . str_replace(' ','',$methodName);
// call method
if(method_exists($this,$methodName))
{
$output .= $this->{$methodName}($row);
}
}
$key++;
}
return $output;
}
}