Master Design is a design template which uses to show all parts of website. It creates all global javascript,css and html layout who helps you to decorate your website very easily. If you know html and php you can create master design very easily. in header section of html:- SphpJsM::addBootStrap(); echo SphpBase::sphp_api()->getHeaderHTML();
For render footer HTML echo SphpBase::sphp_api()->getFooterHTML();
getHeaderHTML() and getFooterHTML() use to insert generated HTML code into HTML output from server.
$dynData is predefined TempFile object which use to show data into Master File. It is called dynamic place. You can insert so many dynamic places in master file with Front Place Object.
Actual Master File has lot of different type of objects. But this is minimum requirement. First design any type of HTML layout and later insert these three line code into a exact position.
Sample master.php file code:-
<?php
switch(SphpBase::page()->getAuthenticateType()){
case 'GUEST':{
$menupath = SphpBase::sphp_settings()->slib_path ."/temp/default/menu.php";
break;
}
case 'ADMIN':{
$menupath = SphpBase::sphp_settings()->slib_path ."/temp/default/admmenu.php";
break;
}
case 'MEMBER':{
$menupath = SphpBase::sphp_settings()->slib_path."/temp/default/mebmenu.php";
break;
}
default:{
$menupath = SphpBase::sphp_settings()->slib_path ."/temp/default/menu.php";
break;
}
}
include_once($menupath);
$menu = new MenuUi();
$menu->run();
//addFrontPlace('videomenu');
runFrontPlace('frontEditor',"footer");
?><!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php SphpJsM::addBootStrap(); echo getHeaderHTML(); ?>
<link href="<?php echo SphpBase::sphp_settings()->slib_res_path ; ?>/temp/default/css/framework.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo SphpBase::sphp_settings()->slib_res_path ; ?>/temp/default/imgs/android-icon-192x192.png" />
<link rel="icon" type="image/png" sizes="32x32" href="<?php echo SphpBase::sphp_settings()->slib_res_path ; ?>/temp/default/imgs/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="<?php echo SphpBase::sphp_settings()->slib_res_path ; ?>/temp/default/imgs/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="16x16" href="<?php echo SphpBase::sphp_settings()->slib_res_path ; ?>/temp/default/imgs/favicon-16x16.png" />
</head>
<body>
<div class="container-fluid">
<div class="row"><div class="col panel">
<div class="row"><div class="col">
<h2 class="heading" style="font-size:36px;"><?php echo $cmpname; ?></h2>
</div>
</div>
<div class="row"><div class="col">
<?php echo $menu->render(); ?>
</div></div>
<div class="row"><div class="col">
<?php SphpBase::$dynData->render(); ?>
</div>
</div>
</div></div></div>
<?php renderFrontPlace('frontEditor',"footer"); echo getFooterHTML(); echo traceError(); echo traceErrorInner(); ?>
</body>
</html>
If you want to insert Temp Files which not depend on application but available on whole website then we can use front places in master file. Menu is a like a front place. For Example
Menu.php file
include_once(SphpBase::sphp_settings()->slib_path . "/comp/bundle/menu/BootstrapMenu.php");
class MenuUi extends BootstrapMenu{
public function onstart() {
//$this->setNavBarCss("navbar sticky-top navbar-expand-md bg-dark navbar-dark");
$this->sphp_api->addMenu("Home", "","fa fa-home","root");
$this->sphp_api->addMenuLink("Home", getAppURL("index"),"fa fa-home","Home");
$this->sphp_api->addMenuLink("Contact Us", getEventURL('page','contacts','index'),"fa fa-fw fa-clock-o","Home");
include_once("plugin/cmenu.php");
}
}
In master file
before getHeaderHTML function call insert:-
include_once($menupath);
$menu = new MenuUi();
$menu->run();
Where want to display menu:- render();
How to use Front Place:-
addFrontPlace('frontEditor',"temp/front1.front","footer");
runFrontPlace('frontEditor',"footer"); (before getHeaderHTML() call)
for display:- renderFrontPlace('frontEditor',"footer");