PHP code example of portavice / cmssystem

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

    

portavice / cmssystem example snippets


use Portavice\CmsSystem\CmsSystem;

$cms = new CmsSystem();

public function setContent(string $content): self

public function setParams(array $params): self

public function setParam(string $key, mixed $value): self

public function removeParam(string $key): self

public function replace(?string $content = null): string

public function splitPattern(string $content): array

use Portavice\CmsSystem\CmsSystem;

$cms = new CmsSystem();

$content = "
    {{ var some_variable }}
    {{ if some_condition }}
        This content is shown if 'some_condition' is true.
    {{ else }}
        This content is shown if 'some_condition' is false.
    {{ endif }}
    {{ foreach items as item }}
        {{ item.name }}
    {{ endforeach }}
";

$params = [
    'some_variable' => 'Hello, World!',
    'some_condition' => true,
    'items' => [
        ['name' => 'Item 1'],
        ['name' => 'Item 2'],
        ['name' => 'Item 3'],
],
];

echo $cms->setParams($params)->replace($content);
bash
php artisan vendor:publish --provider="Portavice\CmsSystem\CmsSystemServiceProvider"
bash
php artisan vendor:publish --provider="Portavice\CmsSystem\CmsSystemServiceProvider" --tag="config" --force