PHP code example of mobytes / htmlext

1. Go to this page and download the library: Download mobytes/htmlext library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mobytes / htmlext example snippets


 namespace App\Tables;

use Mobytes\Htmlext\Table;

class NoticeTable extends Table
{
    //create text button
    protected $btn_new = "Crear nueva noticia";
    
    //Table title 
    protected $title = "Todas las noticias de cepco.org.pe";
    
    //activate the paginate
    protected $paginate = true;
    
    //number of records per page
    protected $per_page = 7;
    
    //Titles of thead
    protected $thead = array(
        "title" => [
            "Titulo",
            "Subtitulo",
            "Contenido",
            "Tags",
            "Actions"
        ]
    );
    
    //records tbody
    protected $tbody = array(
        "fields" => [
            "titulo" => [
                "class" => ""
            ],
            "subtitulo" => [
                "class" => ""
            ],
            "contenido" => [
                "class" => ""
            ],
            "tags" => [
                "class" => ""
            ]
        ]
     );
    
    //Start function    
    public function build()
    {
        $prefix_router = "landpage.noticias";
        $this->build($prefix_router);
    }
}

 namespace App/Http/Controllers;

use Illuminate\Routing\Controller as BaseController;
use Mobytes\Htmlext\TableBuilderTrait;

class NoticesController extends BaseController {
    
    // ...
    use TableBuilderTrait;
    
    public function index()
    {
        //notices type Builder
        $notices = $this->publication->getAllByType(self::$_NOTICE);
        
        $table = $this->table('Mobytes\Landpage\Publication\Table\NoticeTable',$notices);
        
        return View::make(Config::get('notices.index'), compact('table'));
    }
}
 php
    'providers' => [
        // ...
        'Mobytes\Htmlext\HtmlextServiceProvider'
    ]
 php
    'aliases' => [
        // ...
        'TableBuilder'	  => 'Mobytes\Htmlext\Facade\TableBuilder',
    ]