PHP Classes

File: crud360_example8.php

Recommend this page to a friend!
  Classes of Muhammad Usman   PHP CRUD 360 Form Generator   crud360_example8.php   Download  
File: crud360_example8.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CRUD 360 Form Generator
Generate forms for administration panels
Author: By
Last change:
Date: 6 years ago
Size: 1,672 bytes
 

Contents

Class file image Download
<?php
// EXAMPLE 1
include_once("crud360/includes/class.crud360.php");
//Create objects here
$users = new Crud360("users");
$users->paginate(2);
//$users->columns(["avatar","username","email","dob","favorite_color"]);
// best to link tables if your database has foriegn keys, otherwise it will be a problem
$users->setLookupFields("status_id","statuses","id","title");
$users->setLookupFields("department_id","departments","id","title");
$users->formatField("avatar","img");
$users->formatField("dob","date","m/d/Y");
$users->addFormTpl("users");
$users->recordTpl("users",true);
$users->formatField("favorite_color","htmlColor");
$users->setInputType("favcolor","select");

//$users->where("where id>:id",["id"=>24]);


//This call processes all form requests for all the objects
//!!!!MAKE SURE TO CALL THIS AFTER YOU HAVE SET ALL THE OPTIONS JUST BEFORE YOUR HTML BEGINS
Crud360::process([$users]);
//Include bootstrap, datepicker, and essential crud360
include_once("crud360/inc/header.php");
?>
<?php
include_once("crud360/inc/nav.php");?>
<div class="container-fluid">
<?php Crud360::defaultDivs(); ?>
<h3 align="center"> <strong>Example 8:</strong> Set up a single table on a single page! with fields displayed (full width) from a records tpl file </h3>
<?php
      
// this method must be called within a renderable region of an html page, it displays records, creates neccessary forms etc...
       
ob_start();
       
$users->magic();
       
$html = ob_get_clean();
        echo
$html;
       
   
?>
<?php Crud360
::renderSource(__FILE__) ; // display source of this current file ?>

</div>
<?php include_once("crud360/inc/footer.php"); ?>
<?php Crud360
::javascript([$users]); ?>