Skip to content

Instantly share code, notes, and snippets.

@andrewminton
Created February 17, 2014 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewminton/9060057 to your computer and use it in GitHub Desktop.
Save andrewminton/9060057 to your computer and use it in GitHub Desktop.
<?php
require_once(TOOLKIT . '/class.administrationpage.php');
class contentExtensionBackendPagesIndex extends AdministrationPage{
private $pagecontent;
private $backenbdpages;
public function __construct(){
parent::__construct();
include(WORKSPACE . '/backendpages.site.php');
$this->pagecontent = $settings;
}
public function build()
{
include(WORKSPACE . '/backendpages.site.php');
$this->pagecontent = $settings;
parent::build();
$path = $_SERVER['REQUEST_URI'];
$query = explode('?',$path);
$url = $query[1];
$found = self::find_items($this->pagecontent,'handle',$url);
$content = $found[0]['content'];
$title = $found[0]['name'];
$this->setTitle($title);
$this->Context->appendChild(new XMLElement('h2', __($title)));
$this->Contents->appendChild(new XMLElement('div',__($content)));
}
public function find_items($array,$findwhat,$value,$found=array()){
if(is_array($array)){
foreach($array as $k=>$v){
if(is_array($v)){
$result = self::find_items($v,$findwhat,$value,$found);
if($result === true){
$found[] = $v;
}else{
$found = $result;
}
}else{
if($k==$findwhat && $v==$value){
return TRUE;
}
}
}
return $found;
}
}
public function view(){
}
public function __viewIndex(){
}
public function fetchNavigation() {
include(WORKSPACE . '/backendpages.site.php');
$this->backendpages = $settings;
return $this->backendpages;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment