4
4
The Big Picture
5
5
===============
6
6
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
8
8
the base concepts of the Symfony CMF and get you started with it.
9
9
10
10
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
13
13
of the Symfony Framework. If you don't know Symfony, start by reading the
14
14
`Symfony Framework Quick Tour `_.
15
15
16
- Solving the framework versus CMS dilemma
16
+ Solving the Framework versus CMS Dilemma
17
17
----------------------------------------
18
18
19
19
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
23
23
application functionality. It is impossible or at least very hard to customize
24
24
the core parts of the CMS.
25
25
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 `_.
30
30
31
31
The bundles provided by the Symfony CMF can work together, but they are also
32
32
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).
34
34
35
- Downloading the Symfony CMF Standard Edition
36
- --------------------------------------------
35
+ Downloading the Symfony CMF Sandbox
36
+ -----------------------------------
37
37
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
39
43
Symfony CMF Standard Edition. The Symfony CMF Standard Edition is similar to
40
44
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.
43
46
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 _:
45
48
46
49
.. code-block :: bash
47
50
48
- $ composer create-project symfony-cmf/standard-edition cmf ' 1.2.1'
49
-
50
- .. note ::
51
+ $ composer create-project symfony-cmf/sandbox cmf-sandbox
51
52
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
-
58
53
Setting up the Database
59
54
~~~~~~~~~~~~~~~~~~~~~~~
60
55
@@ -63,15 +58,20 @@ something you are used to doing when creating Symfony applications, but the
63
58
Symfony CMF needs a database in order to make a lot of things configurable
64
59
using an admin interface.
65
60
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
67
62
extension. After that, run these commands:
68
63
69
64
.. code-block :: bash
70
65
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
+
71
71
$ php bin/console doctrine:database:create
72
- $ php bin/console doctrine:phpcr:init:dbal
72
+ $ php bin/console doctrine:phpcr:init:dbal --force
73
73
$ php bin/console doctrine:phpcr:repository:init
74
- $ php bin/console doctrine:phpcr:fixtures:load
74
+ $ php bin/console doctrine:phpcr:fixtures:load -n
75
75
76
76
.. tip ::
77
77
@@ -88,11 +88,13 @@ The Request Flow
88
88
89
89
.. tip ::
90
90
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).
94
96
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
96
98
(``http://localhost:8000/ ``) to see the demo:
97
99
98
100
.. image :: ../_images/quick_tour/big-picture-home.png
@@ -170,53 +172,24 @@ this template.
170
172
A view also uses a Menu, provided by the KnpMenuBundle _, and it can have
171
173
integration with Create.js, for live editing.
172
174
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
200
176
------------
201
177
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.
220
193
221
194
Final Thoughts
222
195
--------------
0 commit comments