# sfAlohaPlugin documentation ## Introduction This plugin makes it very easy to turn any HTML element within a template into an editable WYSIWYG field using Aloha Editor. Aloha plugins are included to save the content and upload pictures. The plugin can therefore be used to turn a symfony application into a very basic CMS. ## Features * Very easy integration of Aloha Editor using a helper * Intuitive way to edit web site content in a real WYSIWYG way: the styles in the editor (headers, lists, ...) are the one of the real website. * You therefore define you own styles in a stylesheet file. The user will therefore not have the possibility to change too much the style of the content and turn the website "according to his tastes" * Save content in database (with versioning enabled) * Upload images ## Planned features * ACL (only allow some users to edit content) ## Installation * Go to your symfony project's root directory * Install the plugin (via a package) ./symfony plugin:install --stability=beta sfAlohaPlugin * Install the plugin (via Git): git clone git@github.com:Justpassingby/sfAlohaPlugin.git plugins/sfAlohaPlugin * Activate the plugin in `config/ProjectConfiguration.class.php` [php] class ProjectConfiguration extends sfProjectConfiguration { public function setup() { $this->enablePlugins(array( 'sfDoctrinePlugin', 'sfAlohaPlugin', '...' )); } } * Rebuild the model ./symfony doctrine:build-model ./symfony doctrine:build-sql * Update database tables (Beware! All tables will be deleted and created again from scratch): ./symfony doctrine:insert-sql * Publish plugin assets ./symfony plugin:publish-assets ## Add editable content to a page ### With autoAdd * In a template, render the content [php] <?php use_helper('Aloha'); ?> <?php echo aloha_init_page(); ?> <?php echo aloha_render_element('My Content'); ?> * If the "My content" element is already existing in the database, an editable div element will be rendered with the existing content inside, or it will be created with empty content ### Without autoAdd * Execute ("My content" is an arbitrary name that will be used to easily identify content. It's like a title which won't be displayed) ./symfony aloha:create-content "My content" * In a template, render the content [php] <?php use_helper('Aloha'); ?> <?php echo aloha_init_page(); ?> <?php echo aloha_render_element('My Content'); ?> * Now you can test your page, hover the mouse cursor on the div element, edit it, and click the save button in the Aloha editor toolbar :) ## Configuration * The configuration is done in the plugin's ``config/app.yml`` file, in the ``aloha`` section * ``defaultPlugins``: tells which Aloha plugins to load when calling the ``aloha_init_page`` helper function * ``autoAdd``: tells whether new empty content should be automatically created when it doesn't exist yet * ``image_upload_dir``: tells in which subfolder of the ``web/uploads`` folder images will be uploaded