Lets you bolt-on some simple content editing logic.
- Take care of the content blocks, both front and back end
- Take care of auth
- Provide fancy UI (no save or history, no rich editor libraries)
- Download and copy the files somewhere
- Run
$ composer install
in the library's directory - Run
$ php publishAssets.php
, this will copy the frontend files (asks for path) - Run
$ php resetMigrateDatabase.php
, this will create a SQLite database and necessary table(s) NOTE: This will nuke any existing database! - Create a controller somewhere under your public docroot
<?php
require '../EditableBlocks/EditableBlocks.php';
$editableBlocks = new \EditableBlocks\EditableBlocks();
$editableBlocks->setAccess(true); // Do this only if user is logged in as admin in your own project!
$editableBlocks->controller();
See example/index.php for a complete dummy file.
Below are the important parts.
In your controller (or equivalent):
require '../EditableBlocks/EditableBlocks.php';
$editableBlocks = new \EditableBlocks\EditableBlocks();
$editableBlocks->setAccess(true); // Do this only if user is logged in as admin in your own project!
$editableBlocks->setAssetsUrl('assets/editable_blocks');
$editableBlocks->setBackendEndpointUrl('/editable_blocks_controller.php');
In your head view (or equivalent):
<?php $editableBlocks->assets(); ?>
In your content view (or equivalent):
<div class='content'>
<div class='content-a'>
<?php $editableBlocks->render(['id' => 'example-block']) /* Config array as argument */ ?>
</div>
<!-- content-a -->
<div class='content-b'>
<?php $editableBlocks->render('example-block-b') /* ID string as argument */ ?>
</div>
<!-- content-b -->
</div>
<!-- content -->