Skip to content

mmollay/smart-form

develop
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
js
 
 
 
 
 
 
 
 
 
 
 
 

###Smart-Form v2.x

Smart-Form is a form and list generator, which ensures a quick setup via simple array design.

Basic Usage - Form

Bildschirmfoto 2020-02-06 um 18 39 08

<?php
include_once ("../include_form.php");

$arr ['form'] = array ('id' => 'form_newsletter','action' => 'ajax/handler.php','class' => 'segment attached','width' => '800','align' => 'center' );
$arr ['ajax'] = array ('success' => "$('#show_data').html(data);",'dataType' => 'html' );
$arr ['field'] ['date'] = array ('type' => 'date','label' => 'Date' );
$arr ['field'] ['firstname'] = array ('grid'=>'first', 'type' => 'input','label' => 'Firstname','placeholder' => 'Firstname' );
$arr ['field'] ['secondname'] = array ('grid'=>'second','type' => 'input','label' => 'Secondname','placeholder' => 'Secondname' );
$arr ['field'] ['grid'] = array ('type' => 'grid','class' => '','column' => [ "first" => '8',"second" => "8"] );
$arr ['field'] ['submit'] = array ('type' => 'button','value' => 'Submit','class' => 'submit','align' => 'center' );

$output_form = call_form ( $arr );
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Formular - Small</title>
<link rel="stylesheet" href="../semantic/dist/semantic.min.css">
</head>
<body>
	<div class="ui main text container">
	<?=$output_form['html']?>
	<div id='show_data'></div>
	</div>
	<script src="../jquery/jquery.min.js"></script>
	<script src="../semantic/dist/semantic.min.js"></script>
	<?=$output_form['js']?>
</body>
</html>

Basic Usage - List

Bildschirmfoto 2020-02-06 um 18 38 58

<?php
include ("../include_list.php");
$array = call_list ( 'inc/array_list.php', 'inc/mysql.php' );
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Smart - List - Example</title>
<link rel="stylesheet" href="../semantic/dist/semantic.min.css">
</head>
<body>
	<div class="ui main text container">
	<?=$array['html']?>
	</div>
	<script src="../jquery/jquery.min.js"></script>
	<script src="../semantic/dist/semantic.min.js"></script>
	<script>var smart_form_wp = '../'</script>
	<script src="../js/smart_list.js"></script>
	<?=$array['js']?>
</body>
</html>

inc/array_list.php

<?php
$arr ['list'] = array ('id' => 'demo_list','size' => 'small','class' => 'compact celled striped definitio' );

$arr ['mysql'] ['table'] = "list ";
$arr ['mysql'] ['field'] = "*";
$arr ['mysql'] ['like'] = 'firstname,secondname';
$arr ['mysql'] ['limit'] = '20';

$arr ['th'] ['firstname'] = array ('title' => "Firstname" );
$arr ['th'] ['secondname'] = array ('title' => "Secondname" );
$arr ['th'] ['birthday'] = array ('title' => "Birthday" );

$arr ['tr'] ['buttons'] ['left'] = array ('class' => 'tiny' );
$arr ['tr'] ['button'] ['left'] ['edit'] = array ('title' => '','icon' => 'edit','class' => 'blue mini','modal' => 'edit','popup' => 'Edit' );
$arr ['tr'] ['button'] ['left'] ['edit'] ['onclick'] = "$('#edit>.header').html('{firstname} {secondname}');";

$arr ['top'] ['buttons'] = array ('class' => 'tiny' );
$arr ['top'] ['button'] ['edit'] = array ('title' => 'Add new user','icon' => 'plus','class' => 'blue mini' );

$arr ['modal'] ['edit'] = array ('title' => 'Edit contact','url' => 'ajax/list_form_edit.php','class' => 'small' );
$arr ['modal'] ['edit'] ['button'] ['cancel'] = array ('title' => 'Close','color' => 'green','icon' => 'close' );
$arr ['modal'] ['edit'] ['button'] ['more'] = array ('title' => 'More','onclick' => "alert('test');" );

?>

inc/mysql.php

<?php
$cfg_mysql['user']     = 'demo';
$cfg_mysql['password'] = 'demo12345';
$cfg_mysql['server']   = 'localhost';
$cfg_mysql['db']       = 'demo';

$GLOBALS['mysqli'] = new mysqli ( $cfg_mysql['server'], $cfg_mysql['user'], $cfg_mysql['password'], $cfg_mysql['db'] ) or die ( "Could not open connection to server {$cfg_mysql['server']}" );
?>

License

MIT

About

Smart-Form is a form and list generator, which ensures a quick setup via simple array design.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published