Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Removed more PHP template examples#10020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 13 additions & 35 deletionscontroller.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -417,47 +417,25 @@ you'll use this key to retrieve the message.
In the template of the next page (or even better, in your base layout template),
read any flash messages from the session:

..configuration-block::
..code-block:: html+twig

.. code-block::html+twig
{# app/Resources/views/base.html.twig #}

{# app/Resources/views/base.html.twig #}
{# you can read and display just one flash message type... #}
{% for flash_message in app.session.flashBag.get('notice') %}
<div class="flash-notice">
{{ flash_message }}
</div>
{% endfor %}

{# you can read and display just one flash message type... #}
{% for flash_message in app.session.flashBag.get('notice') %}
<div class="flash-notice">
{# ...or you can read and display every flash message available #}
{% for type, flash_messages in app.session.flashBag.all %}
{% for flash_message in flash_messages %}
<div class="flash-{{ type }}">
{{ flash_message }}
</div>
{% endfor %}

{# ...or you can read and display every flash message available #}
{% for type, flash_messages in app.session.flashBag.all %}
{% for flash_message in flash_messages %}
<div class="flash-{{ type }}">
{{ flash_message }}
</div>
{% endfor %}
{% endfor %}

.. code-block:: html+php

<!-- app/Resources/views/base.html.php -->

// you can read and display just one flash message type...
<?php foreach ($view['session']->getFlashBag()->get('notice') as $message): ?>
<div class="flash-notice">
<?php echo $message ?>
</div>
<?php endforeach ?>

// ...or you can read and display every flash message available
<?php foreach ($view['session']->getFlashBag()->all() as $type => $flash_messages): ?>
<?php foreach ($flash_messages as $flash_message): ?>
<div class="flash-<?php echo $type ?>">
<?php echo $message ?>
</div>
<?php endforeach ?>
<?php endforeach ?>
{% endfor %}

.. note::

Expand Down
38 changes: 10 additions & 28 deletionsforms.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -152,21 +152,12 @@ done by passing a special form "view" object to your template (notice the
``$form->createView()`` in the controller above) and using a set of form
helper functions:

.. configuration-block::

.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{{ form_start(form) }}
{{ form_widget(form) }}
{{ form_end(form) }}

.. code-block:: html+php
.. code-block:: html+twig

<!--app/Resources/views/default/new.html.php -->
<?php echo $view['form']->start($form)?>
<?php echo $view['form']->widget($form)?>
<?php echo $view['form']->end($form)?>
{#app/Resources/views/default/new.html.twig #}
{{ form_start(form)}}
{{ form_widget(form)}}
{{ form_end(form)}}

.. image:: /_images/form/simple-form.png
:align: center
Expand DownExpand Up@@ -432,21 +423,12 @@ Validation is a very powerful feature of Symfony and has its own
but are being prevented by your browser from, for example, submitting
blank fields.

.. configuration-block::

.. code-block:: html+twig

{# app/Resources/views/default/new.html.twig #}
{{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}
{{ form_widget(form) }}
{{ form_end(form) }}

.. code-block:: html+php
.. code-block:: html+twig

<!--app/Resources/views/default/new.html.php -->
<?php echo $view['form']->start($form,array('attr' => array('novalidate' =>'novalidate') ?>
<?php echo $view['form']->widget($form)?>
<?php echo $view['form']->end($form)?>
{#app/Resources/views/default/new.html.twig #}
{{ form_start(form,{'attr': {'novalidate':'novalidate'}}) }}
{{ form_widget(form)}}
{{ form_end(form)}}

.. index::
single: Forms; Built-in field types
Expand Down
73 changes: 18 additions & 55 deletionsfrontend/assetic/apply_to_option.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,22 +67,11 @@ Filter a single File
You can now serve up a single CoffeeScript file as JavaScript from within your
templates:

.. configuration-block::

.. code-block:: html+twig

{% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
.. code-block:: html+twig

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array('@AppBundle/Resources/public/js/example.coffee'),
array('coffee')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach ?>
{% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

This is all that's needed to compile this CoffeeScript file and serve it
as the compiled JavaScript.
Expand All@@ -92,27 +81,13 @@ Filter multiple Files

You can also combine multiple CoffeeScript files into a single output file:

.. configuration-block::

.. code-block:: html+twig
.. code-block:: html+twig

{% javascripts '@AppBundle/Resources/public/js/example.coffee'
'@AppBundle/Resources/public/js/another.coffee'
filter='coffee' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array(
'@AppBundle/Resources/public/js/example.coffee',
'@AppBundle/Resources/public/js/another.coffee',
),
array('coffee')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach ?>
{% javascripts '@AppBundle/Resources/public/js/example.coffee'
'@AppBundle/Resources/public/js/another.coffee'
filter='coffee' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

Both files will now be served up as a single file compiled into regular JavaScript.

Expand DownExpand Up@@ -188,24 +163,12 @@ template. You can also list regular JavaScript files, all of which will be
combined and rendered as a single JavaScript file (with only the ``.coffee``
files being run through the CoffeeScript filter):

.. configuration-block::
.. code-block:: html+twig

{% javascripts '@AppBundle/Resources/public/js/example.coffee'
'@AppBundle/Resources/public/js/another.coffee'
'@AppBundle/Resources/public/js/regular.js' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}


.. code-block:: html+twig

{% javascripts '@AppBundle/Resources/public/js/example.coffee'
'@AppBundle/Resources/public/js/another.coffee'
'@AppBundle/Resources/public/js/regular.js' %}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}

.. code-block:: html+php

<?php foreach ($view['assetic']->javascripts(
array(
'@AppBundle/Resources/public/js/example.coffee',
'@AppBundle/Resources/public/js/another.coffee',
'@AppBundle/Resources/public/js/regular.js',
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach ?>
Loading

[8]ページ先頭

©2009-2025 Movatter.jp