PHP code example of ox-harris / phpfront

1. Go to this page and download the library: Download ox-harris/phpfront 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/ */

    

ox-harris / phpfront example snippets


  Include ‘PHPFront/lib/PHPFront.php’;

  // If you stored the PHPFront folder in a different location, your /PHPFront/lib/PHPFront.php’;
  

  $PHPFront = new PHPFront;
  

  $PHPFront->setTemplate(‘template.html’);

  // If your stored template.html in a different location, your path would change.
  // Where ‘path-to-template is your actual path to where you stored template.html
  $PHPFront->setTemplate(‘path-to-template/template.html’);
  

  // For document title (title)
  $PHPFront->find(‘title’)->html(‘This is document title’);

  // For page heading 1 (h1)
  $PHPFront->find(‘h1’)->html(‘Hello World!’);

  // For page paragraph (p)
  $PHPFront->find(‘p’)->html(‘Here is my first PHPFront project’)->addClass('rounded-corners')->css('color', 'gray');
  
  // Load a HTML fragment into a DIV and manipulate its content
  $PHPFront->find('#container')->load(__DIR__.'/templates/table.html')->find('tr:even')->css('background-color', 'whitesmoke')
  ->parents('table')->attr('id', 'employee-table')->append('<tr><td>342</td><td>John Doe</td></tr>');
  

  $PHPFront->render();