Skip to content

Instantly share code, notes, and snippets.

@Logiks
Created February 17, 2014 15:05
Show Gist options
  • Save Logiks/9052241 to your computer and use it in GitHub Desktop.
Save Logiks/9052241 to your computer and use it in GitHub Desktop.
Sample content page for Home pages. This covers all the body of the home page not banner, footer etc. This considers the understanding the a home_layout.json file is found in <APPROOT>misc/jsondb #Logiks-Boilerplates
<?php
if(!defined('ROOT')) exit('No direct script access allowed');
loadModule("content");
if(!isset($json)) $json=new SimpleJSONDB();
$layouts=$json->getItem("home_layout","LAYOUTS");
//printArray($layouts);
$defWidgetConf=array(
"css"=>"",
"class"=>"",
"type"=>"",
"data"=>"",
"params"=>array()
);
$defLayoutConf=array(
"show"=>true,
"css"=>"",
"class"=>"",
);
function printHomePane($pane) {
if(strlen($pane['data'])<=0) continue;
if($pane['type']=="widget") {
loadWidget($pane['data']);
}
}
?>
<div class='wrapper'>
<div class="full">
<?php
foreach($layouts as $key => $value) {
$value=array_merge($defLayoutConf,$value);
if(!$value['show']) continue;
echo "<div id='$key' class='layer {$value['class']}' style='{$value['css']}'>";
if(isset($value['panes']) && count($value['panes'])>0) {
foreach($value['panes'] as $pane) {
$pane=array_merge($defWidgetConf,$pane);
echo "<div class='block {$pane['class']}' style='{$pane['css']}'>";
printHomePane($pane);
echo "</div>";
}
}
echo "</div>";
}
?>
</div>
</div>
{
"LAYOUTS": {
"layer1": {
"show": false,
"css": "height:550px;padding:10px;padding-left: 11%;",
"class": "",
"panes": [
{
"css": "width:500px;height:500px;padding:0px;border:0px;-webkit-box-shadow: none;box-shadow: none;",
"class": "",
"type": "widget",
"data": "updates"
},
{
"css": "width:250px;height:250px;",
"class": "",
"type": "widget",
"data": "photobox"
},
{
"css": "width:250px;height:150px;",
"class": "",
"type": "widget",
"data": "blogs"
}
]
},
"layer2": {
"show": false,
"css": "min-height: 320px;clear: both;",
"class": "",
"panes": [
{
"css": "",
"class": "",
"type": "widget",
"data": "all_msgs"
}
]
},
"layer3": {
"show": false,
"css": "min-height: 100px;height: 125px;width: 98%;padding:0px;",
"class": "",
"panes": [
{
"css": "width: 100%;padding:0px;",
"class": "",
"type": "widget",
"data": "photospinner"
}
]
},
"layer4": {
"show": true,
"css": "height:300px;min-height: 300px;padding:4px;padding-left: 50%;",
"class": "",
"panes": [
{
"css": "width:1000px;height:300px;margin-left:-500px;-webkit-border-radius:0px;border-radius:0px;padding:0px;border:0px;-webkit-box-shadow: none;box-shadow: none;",
"class": "",
"type": "widget",
"data": "layer_connect"
}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment