PHP Classes

PHP Modal Box: Display modal boxes using Bootstrap

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 262 All time: 7,789 This week: 47Up
Version License PHP version Categories
bs4_modal_class 1.0.0Freely Distributable5HTML, PHP 5
Description 

Author

This class can be used to display modal boxes using Bootstrap.

It can generate HTML using Bootstrap CSS styles to display modal dialogs using given content.

The class can be configured to set the HTML content for the title, body, footer, animation type, close button, etc..

Picture of muneeb aslam
  Performance   Level  
Name: muneeb aslam <contact>
Classes: 1 package by
Country: Pakistan Pakistan
Age: ???
All time rank: 394348 in Pakistan Pakistan
Week rank: 206 Up5 in Pakistan Pakistan Up

Recommendations

What is the best PHP modal submit form remains opened class?
Make a modal popup that will not close after submit

Example

<?php
    $varName
= new ModalBox;
   
   
//lets first set the modal id
   
$varName->setId('modal_id');
   
   
//Set the title of to be used in header (optional)
   
$varName->setTitle("modal title");
   
   
// Set the body content of the modal
   
$varName->setBodyContent("modal body content");
   
   
// Set the footer of the modal (optional)
   
$varName->setFooterContent("modal footer content");
   
   
//--------
    // Finally initiate the function to build the modal
    // This function has the following 6 arguments
    // 1. Modal Animation Type: fade etc. Put 'false' in single quotes to disable it
    // 2. Modal Header display Option. Boolean (true/ false)
    // 3. Modal Header Title display Option. Boolean (true/ false)
    // 4. Modal Close X on top Option. Boolean (true/ false)
    // 5. Modal Footer Display Option. Boolean (true/ false)
    // 6. Modal Footer close button display Option. Boolean (true/ false)
    //
    // The following parameters will add a modal of fade animation with everything (header, title, buttons footer etc) displayed
   
   
$varName->initiateModal('fade',true,true,true,true,true);
   
   
// NOTE: You will manualy need to add a button bound to this modal and add data-target as modal id.
?>


  Files folder image Files (2)  
File Role Description
Plain text file bs4_modal_class.php Class Add a bs modal anywhere without writing the whole code
Accessible without login Plain text file Usage.php Example How to use the class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:262
This week:0
All time:7,789
This week:47Up