Skip to content

Instantly share code, notes, and snippets.

@imvision
Created March 4, 2014 11:22
Show Gist options
  • Save imvision/9344675 to your computer and use it in GitHub Desktop.
Save imvision/9344675 to your computer and use it in GitHub Desktop.
Experimental Front Controller that can return content in multiple formats.
<?php
require "startup.php";
$action = (isset($_REQUEST['action']) && $_REQUEST['action']!="" && file_exists(__DIR__."/{$_REQUEST['action']}.php")) ? $_REQUEST['action'] : "sources";
?>
<?php if(! isset($_REQUEST['request_type']) || $_REQUEST['request_type']!="ajax"): ?>
<?php include('header.php');?>
<div id="content">
<?php endif;?>
<?php require __DIR__."/{$action}.php";?>
<?php if(! isset($_REQUEST['request_type']) || $_REQUEST['request_type']!="ajax"): ?>
</div>
<?php include('footer.php');?>
<?php endif;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment