PHP Dashboard Page

Summary

PHP Dashboard page is a guideline to make a convenient template to for a dashboard page with PHP, MySQL and JavaScript.

Prerequisites

  • MVC structure in PhP.
  • Security
  • Nice and clean features in JavaScript.

Codes for accordions:

$('#role-personnel').DataTable({
		"dom": 'Bfrtip',
		"columnDefs": [
			{ className: "dt-left","targets": [1,2,3] } // sort-able fields
		],
		"buttons": [
			{
				extend: 'excelHtml5',
				text:      '',
				titleAttr: 'Excel',
				title: 'A title',
				className: 'green'
			},
			{
				extend: 'pdfHtml5',
				text:      '',
				titleAttr: 'PDF',
				title: 'A title',
				className: 'red'
			}
		],
		"order": [[ 1, "desc" ]],
		"scrollX": false,
		"searching": true,
		"pageLength": page_length_to_be_set,
		"fixedHeader": {
			header: true,
			footer: true
		},
		"footerCallback": function ( row, data, start, end, display ) {
			var api = this.api(), data;
			
			// hide paging if number of records smaller than page_length_to_be_set
			if (end < page_length_to_be_set) {
				$(this).siblings('.dataTables_paginate').hide();
			}
		}
	});

Source Files (for reference)