PHP code example of broccoli-html-editor / kaleflower

1. Go to this page and download the library: Download broccoli-html-editor/kaleflower 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/ */

    

broccoli-html-editor / kaleflower example snippets



aleflowerインスタンスを作成
$kaleflower = new \kaleflower\kaleflower();

// kflowファイルを読み込み
$kaleflower->load('/path/to/your/file.kflow');

// HTML、CSS、JavaScriptを生成
$result = $kaleflower->build(array(
    'assetsPrefix' => './assets/',
));

// 結果の取得
if ($result->result) {
    echo $result->html->main;      // メインコンテンツのHTML
    echo $result->html->any;       // その他任意の部分のHTML(存在する場合)
    echo $result->css;             // 生成されたCSS
    echo $result->js;              // 生成されたJavaScript
    
    // アセットファイルの処理
    foreach ($result->assets as $asset) {
        // $asset->path: アセットのパス
        // $asset->base64: Base64エンコードされたアセットデータ
    }
} else {
    echo 'Error: ' . $result->error;
}

$result = $kaleflower->build('/path/to/your/file.kflow', array(
    'assetsPrefix' => './assets/',
));

$xmlSource = '<?xml version="1.0" encoding="UTF-8"