1. Extension for symfony
geared towards content
based web applications.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
2. The Idea
• Sympal was born out of years of building
content based web applications using various
frameworks and tools in different languages.
• The name was born from wanting the
functionality Drupal provides but in a good
way, like in symfony
(Drupal - bad code) + symfony = Sympal
Sympal Introduction www.symfony-project.com www.sensiolabs.com
4. What does it add?
• Extra tasks
• Extra functions in your base sfActions
• Better integrated support for e-mail sending
• Easy interactive installation
• Addon plugins that can be one click installed
• Menus/sitemap, admin bar, editor menu, etc.
• Custom content types
• Custom content slot types
• Lots more tools
Sympal Introduction www.symfony-project.com www.sensiolabs.com
5. Additional Tasks
$ ./symfony list sympal
Available tasks for the quot;sympalquot; namespace:
:install Install the sympal plugin content management framework.
:plugin-download Download a sympal plugin to an existing sympal installation
:plugin-generate Generate the skeleton for a sympal plugin
:plugin-install Install a sympal plugin to an existing sympal installation
:plugin-uninstall Uninstall a sympal plugin to an existing sympal installation
Sympal Introduction www.symfony-project.com www.sensiolabs.com
6. Generate Sympal Plugin
Generate a new Sympal plugin from the command line
$ ./symfony sympal:plugin-generate Event --content-type=Event
This command will create a new plugin named sfSympalEventPlugin
Are you sure you want to proceed? (y/N)
sfSympalEventPlugin
config/
doctrine/
schema.yml
routing.yml
sfSympalEventPluginConfiguration.class.php
data/
fixtures/
install.yml
lib/
Sympal Introduction www.symfony-project.com www.sensiolabs.com
8. Default Sympal Plugin Install
• Adds new menu item
• Adds new content type
• Adds sample content record
Sympal Introduction www.symfony-project.com www.sensiolabs.com
9. Download Sympal Plugin
• You can download and install new sympal
plugins from the web interface or from the
command line
Sympal Introduction www.symfony-project.com www.sensiolabs.com
10. Install Sympal Blog
• One click install a blog
• Downloads from svn or pear and runs
installation
Sympal Introduction www.symfony-project.com www.sensiolabs.com
12. Add Sympal Comments to Blog
• The sfSympalBlogPlugin was built to work
with sfSympalCommentsPlugin so all we need
to do is install it to add comments to our
blog.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
13. Sympal Events
• Events are implemented in Sympal so you can
easily custom admin menus, the editor
toolbar, etc.
– sympal.load_admin_bar
– sympal.load_settings
– sympal.load_tools
Sympal Introduction www.symfony-project.com www.sensiolabs.com
14. Sympal Events
Hook in to the sympal events so you can customize and add things for your needs
class sfSympalSamplePluginConfiguration extends sfPluginConfiguration
{
public static
$dependencies = array(
'sfSympalPlugin'
);
public function initialize()
{
$this->dispatcher->connect('sympal.load_admin_bar', array($this, 'loadAdminBar'));
}
public function loadAdminBar(sfEvent $event)
{
$menu = $event['menu'];
$administration = $menu->getChild('Administration');
$administration->addChild('New Item', '@new_item_route');
}
}
Sympal Introduction www.symfony-project.com www.sensiolabs.com
17. Sympal Rich Text Editing
• Easily upload photos to your content
• Create rich content with the YUI Rich Text
editor
Sympal Introduction www.symfony-project.com www.sensiolabs.com
18. Sympal Rich Text Editing
Sympal Introduction www.symfony-project.com www.sensiolabs.com
19. Sympal Content Form
• If you don’t want to edit content inline you
can always edit from a backend form
Sympal Introduction www.symfony-project.com www.sensiolabs.com
20. Sympal Content Types
• Sympal core only provides one content type
and it is a basic CMS page with a title and a
body
• You can easily add new content types to
sympal for your project. i.e. Article, Event,
etc.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
21. Sympal Content Slot Types
• Sympal providers four different built in
content types.
– Text - Single one line input text box
– MultiLineText - Multi line input text box
– RichText - YUI rich text editor
– Markdown - Same as MultiLineText but rendered
with Markdown
Sympal Introduction www.symfony-project.com www.sensiolabs.com
22. Sympal Configuration
• Everything in sympal is configurable via web
interface or yaml.
all:
sympal_settings:
recaptcha_public_key: 6Ld2DgQAAAAAAApXLteupHPcbSxbSHkhNTuYLChX
recaptcha_private_key: 6Ld2DgQAAAAAANIbaXJsFEBOyg56CL_ljy3APlPb
language_codes: [en, fr, es]
disallow_php_in_content: false
default_layout: sympal
rows_per_page: 10
I18n:
enabled: true
ContentSlot: true
MenuItem: true
sympal_plugin_svn_sources: [quot;http://svn.symfony-project.com/pluginsquot;]
markdown_styled_boxes: [quote, tip, caution, note]
Sympal Introduction www.symfony-project.com www.sensiolabs.com
23. Sympal Configuration
• Change configuration from sympal in
browser
Sympal Introduction www.symfony-project.com www.sensiolabs.com
24. Sympal Sites
• With sympal you can easily manage multiple
sites from one installation.
• A sympal site is bound to a symfony
application
require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration('sympal', 'prod', false);
sfContext::createInstance($configuration)->dispatch();
Sympal Introduction www.symfony-project.com www.sensiolabs.com
25. Sympal Breadcrumbs
• Since sympal manages your sitemap we can
easily generate breadcrumbs from your
current position.
<?php echo get_sympal_breadcrumbs($menuItem) ?>
• Of course if you want to generate
breadcrumbs manually you can do so
<?php echo get_sympal_breadcrumbs(array(
'Home' => '@homepage',
'About' => '@about',
'Jonathan H. Wage' => null
)) ?>
Sympal Introduction www.symfony-project.com www.sensiolabs.com
26. Sympal Menus
• Working with menus in sympal,
are...well...simple :) and very efficient
Sympal Introduction www.symfony-project.com www.sensiolabs.com
27. Sympal Menus
• Menus only ever require one query no matter
how many menus you have and how many
times you call/render them in one page
</p>
<?php echo get_sympal_menu('footer') ?>
</div>
<!-- end footer -->
Sympal Introduction www.symfony-project.com www.sensiolabs.com
28. Sympal Sub-menus
• You can easily retrieve a sub menu for a
menu item by simply passing it to the
get_sympal_menu() method.
• In this example we get the sub menu for the
current menu item.
<?php $subMenu = get_sympal_menu($currentMenuItem) ?>
Sympal Introduction www.symfony-project.com www.sensiolabs.com
29. Sympal Routing
• Multiple urls for content
• Specify one url as primary
• Change urls without affecting seo and
creating 404s
• Custom urls for individual content or content
types
Sympal Introduction www.symfony-project.com www.sensiolabs.com
30. Security
• Sympal implements your basic security model
using users, groups and permissions.
• All content and menus can be restricted for
certain users, groups, permissions, etc.
• Menus can require auth, no auth, etc.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
31. Sympal E-Mail
• You can easily send and manage your
application e-mails with sympal.
$variables = array(
'forgot_password' => $forgotPassword,
'email_address' => $this->form->user->email_address,
'user' => $this->form->user
);
$this->sendEmail('sympal_forgot_password/send_request', $variables);
• First argument can be path to partial or
component
• Second argument is array of variables for e-
mail
Sympal Introduction www.symfony-project.com www.sensiolabs.com
32. Sympal E-Mail
• In a sympal e-mail template the subject is
the first line and body is everything else.
Forgot Password Request for <?php echo $user->getUsername() ?>
Hello <?php echo $user->getName() ?>,<br/><br/>
This e-mail is being sent because you requested information on how to reset your
password.<br/><br/>
You can change your password by clicking the below link which is only valid for
24 hours:<br/><br/>
<?php echo link_to('Click to change password', '@sympal_forgot_password_change?
unique_key='.$forgot_password->unique_key) ?>
• This is so the subject and body of your e-
mails are managed in one place.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
33. Sympal Action Confirmations
• Often you want to confirm an action in
symfony. A delete, or some intense
operation. Usually this is only possible client
side. Until now!
public function executeDelete(sfWebRequest $request)
{
$this->askConfirmation('Please Confirm', 'Are you sure you wish to delete this record?');
$user = $this->getRoute()->getObject();
$user->delete();
$this->getUser()->setFlash('notice', 'User was deleted successfully!');
$this->redirect('@homepage');
}
• Clicking yes will re-send action with
confirmation and continue execution.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
34. New Menu Manager
Makes use of YUI tree and menus to manage your
menus. Current system is un-finished and uses jQuery.
Sympal Introduction www.symfony-project.com www.sensiolabs.com
35. More to come
• More YUI in the interface
• General cleanup and enhancing of interface
• Add more Sympal addon plugins
• Fix bugs
• Create documentation
Sympal Introduction www.symfony-project.com www.sensiolabs.com