Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 6307df0

Browse files
authored
Merge pull request #802 from symfony-cmf/best-practices-quick-tour
[quick tour] updating the quick tour
2 parents 87ebd14 + ba4955a commit 6307df0

13 files changed

+230
-374
lines changed
Loading
Loading
-7.37 KB
Binary file not shown.
-44.1 KB
Binary file not shown.
-29.5 KB
Binary file not shown.
-30.4 KB
Binary file not shown.
44.2 KB
Loading

big-picture-home.png

83.3 KB
Loading

quick_tour/the_big_picture.rst

Lines changed: 47 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
The Big Picture
55
===============
66

7-
Start using the Symfony CMF in 10 minutes! This chapter will walk you through
7+
Start using the Symfony CMF in 10 minutes! This quick tour will walk you through
88
the base concepts of the Symfony CMF and get you started with it.
99

1010
It's important to know that the Symfony CMF is a collection of bundles which
@@ -13,7 +13,7 @@ Framework. Before you read further, you should at least have a basic knowledge
1313
of the Symfony Framework. If you don't know Symfony, start by reading the
1414
`Symfony Framework Quick Tour`_.
1515

16-
Solving the framework versus CMS dilemma
16+
Solving the Framework versus CMS Dilemma
1717
----------------------------------------
1818

1919
Before starting a new project, there is a difficult decision on whether it
@@ -23,38 +23,33 @@ other hand, when choosing to use a CMS, it's more difficult to build custom
2323
application functionality. It is impossible or at least very hard to customize
2424
the core parts of the CMS.
2525

26-
The CMF is created to solve this framework versus CMS dilemma. It provides
27-
bundles, so you can easily add CMS features to your project. But it also
28-
provides flexibility and in all cases you are using the framework, so you can
29-
build custom functionality the way you want. This is called a `decoupled CMS`_.
26+
The Symfony CMF is created to solve this framework versus CMS dilemma. It
27+
provides Symfony bundles to easily add CMS features to your project. Yet, as
28+
you're still using the Symfony framework, you can build any custom functionality
29+
you can think of. This flexibility is called a `decoupled CMS`_.
3030

3131
The bundles provided by the Symfony CMF can work together, but they are also
3232
able to work standalone. This means that you don't need to add all bundles, you
33-
can decide to only use one of them (e.g. only the RoutingBundle or the MediaBundle).
33+
can decide to only use one of them (e.g. only the RoutingBundle).
3434

35-
Downloading the Symfony CMF Standard Edition
36-
--------------------------------------------
35+
Downloading the Symfony CMF Sandbox
36+
-----------------------------------
3737

38-
When you want to start using the CMF for a new project, you can download the
38+
To explore the CMF, it is best to download the Symfony CMF Sandbox. The sandbox
39+
contains demonstrations for many of the CMF features and is a good playground
40+
to familiarize yourself with the CMF.
41+
42+
When you want to start an actual project with the CMF, best download the
3943
Symfony CMF Standard Edition. The Symfony CMF Standard Edition is similar to
4044
the `Symfony Standard Edition`_, but contains and configures essential Symfony
41-
CMF bundles. It also adds a very simple bundle to show some of the basic
42-
Symfony CMF features.
45+
CMF bundles.
4346

44-
The best way to download the Symfony CMF Standard Edition is using Composer_:
47+
The best way to download the Symfony CMF Sandbox is using Composer_:
4548

4649
.. code-block:: bash
4750
48-
$ composer create-project symfony-cmf/standard-edition cmf '1.2.1'
49-
50-
.. note::
51+
$ composer create-project symfony-cmf/sandbox cmf-sandbox
5152
52-
The `AcmeDemoBundle` that is used in this tour was removed in
53-
version 1.3 of the Symfony CMF Standard Edition. Since then it has
54-
become the skeleton for a simple CMS application. This is why we
55-
install version 1.2.1. If you insist on checking out the most
56-
recent versions of the CMF, check out `symfony-cmf/cmf-sandbox`.
57-
5853
Setting up the Database
5954
~~~~~~~~~~~~~~~~~~~~~~~
6055

@@ -63,15 +58,20 @@ something you are used to doing when creating Symfony applications, but the
6358
Symfony CMF needs a database in order to make a lot of things configurable
6459
using an admin interface.
6560

66-
To quickly get started, it is expected that you have enabled the sqlite
61+
To quickly get started, it is expected that you have enabled the sqlite PHP
6762
extension. After that, run these commands:
6863

6964
.. code-block:: bash
7065
66+
$ cd cmf-sandbox
67+
$ cp app/config/phpcr_doctrine_dbal.yml.dist app/config/phpcr.yml
68+
# Or when you're on a Windows PC:
69+
# $ copy app\config\phpcr_doctrine_dbal.yml.dist app\config\phpcr.yml
70+
7171
$ php bin/console doctrine:database:create
72-
$ php bin/console doctrine:phpcr:init:dbal
72+
$ php bin/console doctrine:phpcr:init:dbal --force
7373
$ php bin/console doctrine:phpcr:repository:init
74-
$ php bin/console doctrine:phpcr:fixtures:load
74+
$ php bin/console doctrine:phpcr:fixtures:load -n
7575
7676
.. tip::
7777

@@ -88,11 +88,13 @@ The Request Flow
8888

8989
.. tip::
9090

91-
When you have at least PHP 5.4, use the ``server:run`` command to run a
92-
local server for the demo. Otherwise, use a ``localhost`` and prefix the URLs
93-
in this document with ``/path-to-project/web/app_dev.php/``.
91+
Use the ``server:run`` command to run a local server for the demo. If you
92+
use a web server like Nginx or Apache, you need to prefix the URLs
93+
in this document with ``app_dev.php/`` (and the path to the ``web`` folder
94+
inside the Symfony project, if that is not already the root folder of your
95+
server).
9496

95-
Now, the Standard Edition is ready to use. Navigate to the homepage
97+
Now, the Sandbox is ready to use. Navigate to the homepage
9698
(``http://localhost:8000/``) to see the demo:
9799

98100
.. image:: ../_images/quick_tour/big-picture-home.png
@@ -170,53 +172,24 @@ this template.
170172
A view also uses a Menu, provided by the KnpMenuBundle_, and it can have
171173
integration with Create.js, for live editing.
172174

173-
Adding a New Page
174-
-----------------
175-
176-
Now you know the request flow, you can start adding a new page. In the Symfony
177-
CMF Standard Edition, the data is stored in data files, which are loaded when
178-
executing the ``doctrine:phpcr:fixtures:load`` command. To add a new page, you
179-
just need to edit such a data file, which is located in the
180-
``src/Acme/DemoBundle/Resources/data`` directory:
181-
182-
.. code-block:: yaml
183-
184-
# src/Acme/DemoBundle/Resources/data/pages.yml
185-
Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page:
186-
# ...
187-
188-
quick_tour:
189-
id: /cms/simple/quick_tour
190-
label: "Quick Tour"
191-
title: "Reading the Quick Tour"
192-
body: "I've added this page while reading the quick tour"
193-
194-
After this, you need to run the ``doctrine:phpcr:fixtures:load`` to reflect
195-
the changes on the database and after refreshing, you can see your new page!
196-
197-
.. image:: ../_images/quick_tour/big-picture-new-page.png
198-
199-
Live Editing
175+
The Fixtures
200176
------------
201177

202-
Now is the time you become an admin of this site and editing the content using
203-
the Web Interface. To do this click on "Admin Login" and use the provided
204-
credentials.
205-
206-
You'll see that you have a new bar at the top of the page:
207-
208-
.. image:: ../_images/quick_tour/big-picture-createjs-bar.png
209-
210-
This bar is generated by the `Create.js`_ library. The Symfony CMF integrates
211-
the CreatePHP_ and `Create.js`_ libraries using a CreateBundle. This enables
212-
you to edit a page using a full WYSIWYG editor when you are reading the page.
213-
214-
Now you can change the content of our new page using Create.js:
215-
216-
.. image:: ../_images/quick_tour/big-picture-edit-page.png
217-
218-
After clicking "save", the changes are saved using the CreateBundle and the
219-
content is updated.
178+
Now you know the request flow, you can start editing content. While the normal
179+
usage will be to edit content through a web interface, the CMF sandbox also
180+
supports loading content from static files. This is mainly useful for testing
181+
purposes.
182+
183+
The fixtures are loaded with the ``doctrine:phpcr:fixtures:load`` command. To
184+
edit the home page, edit the first entry in
185+
``src/AppBundle/Resources/data/page.yml`` to say something different. Then, run
186+
the ``doctrine:phpcr:fixtures:load`` command to get the changes into the
187+
content repository. After refreshing the browser, you can see your
188+
modifications!
189+
190+
Don't worry, editing fixture files is only done for developing and testing. The
191+
CMF comes with a Sonata admin integration for convenient online editing, or you
192+
can build your own editing systems.
220193

221194
Final Thoughts
222195
--------------

0 commit comments

Comments
 (0)