![]() |
|
sfAlohaPlugin - 0.2.0A plugin to edit content using Aloha Editor |
|
![]() |
2
users
Sign-in
to change your status |
Michaël Perrin |
Turn any HTML element within a symfony 1.4 template into an editable WYSIWYG field using Aloha Editor
| Name | Status | |
|---|---|---|
|
|
lead | se.lucitrap <<ta>> onanga.tnecniv |
Copyright (c) 2012 Michaël Perrin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 0.2.0beta | MIT license | 0.2.0beta | 27/04/2012 |
| 0.1.1beta | MIT license | 0.1.0beta | 25/04/2012 |
| 0.1.0beta | MIT license | 0.1.0beta | 23/04/2012 |
| Version | License | API | Released |
|---|---|---|---|
| 0.2.0beta | MIT license | 0.2.0beta | 27/04/2012 |
| 0.1.1beta | MIT license | 0.1.0beta | 25/04/2012 |
| 0.1.0beta | MIT license | 0.1.0beta | 23/04/2012 |
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.
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
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
In a template, render the content
<?php use_helper('Aloha'); ?> <?php echo aloha_init_page(); ?> <?php echo aloha_render_element('My Content'); ?>
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 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 :)
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
