Plugins allow other applications to come to our application. Previously, we had to create an application that we would add using our MVC CRUD. In our application plugins us Login and Config.
How to make plugins? First, create a folder in the comet and place the subfolders (modelview view controller).
When you create your plugin and place it in a folder, you also need to call the basic indes.php to show what you have done. You will do this by calling the callus and function from the view of your plugin that you have made.
Example call plugin in index.php
<?php
include 'app/plugins/login/view/index.php';
$call = new Lo();
$call-> login();
?>
You can also use our GRID which we used in this Framework.
Firts create model. Model serves for CRUD functionality. (select, insert, delete).
Example:
<?php
class Mycrud {
function crud() {
global $link;
$sql = "SELECT * from confing where id='$id'";
$result = $link->query($sql);
while ($res = $result->fetch_assoc()) {
$array[] = $res;
}
return $array;
}
}
?>
Of course it is necessary to add a link for the connection with the database.
Example:
include '../../../install/dbconnect.php';
The controller is used to scroll through the data that we previously selected in the model. We need to give both the class and the function from the model.
Example:
<?php
require_once 'model.php';
class listarController{
private $lista;
protected $id;
public function vlada(){
$lista = new Config();
$lista->getMe();
$res = $lista->getMe();
foreach ($res as $value){
?>
Name: <h2><?php echo $value['name']; ?></h2>
Site title: <h2><?php echo $value['title']; ?></h2>
Site name: <h2><?php echo $value['site_name']; ?></h2>
Header: <h2><?php echo $value['header']; ?></h2>
Footer: <h2><?php echo $value['footer']; ?></h2>
User: <h2><?php echo $value['user']; ?></h2>
<?php
}
}
}
?>
View overrides everything we selected in the module and listed in the controller. Of course you need to add class and function from the controller.
Example
<?php
require_once 'controller.php';
$lista1 = new listarController();
$lista1->vlada();
?>