PHP code example of samsoncms / api

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

    

samsoncms / api example snippets


class MyTable extends \samsoncms\api\MyGeneratedTable
{
    protected $indexView = 'specify a path to index view file';
    protected $rowView = 'specify a path to row view file';
}

// Creating an instance, with QueryInterface, ViewInterface and Entity identifier
$table = new MyTable($query, $this, $material->MaterialID)

<div class='my-table'>
    <h2>Table title<h2>
    <div class="my-table-rows">
         echo $rows 

 /** @var \myapplication\MyTableRow $row */

/** @var \samsoncms\api\Field $fieldRecord Try to find additional field record */
$fieldRecord = \samsoncms\api\Field::byNameOrID('image')
if (isset($fieldRecord)) {
    // Additional field has been found
}

/** @var \samsoncms\api\Field $fieldRecord Try to find additional field record */
if (\samsoncms\api\Field::byNameOrID('image', $fieldRecord)) {
    // Additional field has been found
}
public function setFieldByID($fieldID, $value, $locale = DEFAULT_LOCALE)
\samsoncms\api\Field::byID($query, $identifier, &$return = null)
\samsoncms\api\Field::byName($query, $name, &$return = null)
\samsoncms\api\Field::byNameOrID($query, $identifier, &$return = null)