Skip to content

Commit

Permalink
minor #4436 remove semicolons in PHP templates (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

remove semicolons in PHP templates

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets |

Commits
-------

3d07e1a remove semicolons in PHP templates
  • Loading branch information
wouterj committed Nov 8, 2014
2 parents 97c4b2e + 3d07e1a commit 5d6d0c2
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ the ``notice`` message:
<div class="flash-notice">
<?php echo "<div class='flash-error'>$message</div>" ?>
</div>
<?php endforeach; ?>
<?php endforeach ?>

By design, flash messages are meant to live for exactly one request (they're
"gone in a flash"). They're designed to be used across redirects exactly as
Expand Down
8 changes: 4 additions & 4 deletions book/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ persisted to the database. Writing in flat PHP is quick and dirty:
<?php echo $row['title'] ?>
</a>
</li>
<?php endwhile; ?>
<?php endwhile ?>
</ul>
</body>
</html>
Expand Down Expand Up @@ -121,7 +121,7 @@ is primarily an HTML file that uses a template-like PHP syntax:
<?php echo $post['title'] ?>
</a>
</li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>
</body>
</html>
Expand Down Expand Up @@ -238,7 +238,7 @@ the layout:
<?php echo $post['title'] ?>
</a>
</li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>
<?php $content = ob_get_clean() ?>

Expand Down Expand Up @@ -603,7 +603,7 @@ database and the Templating component to render a template and return a
<?php echo $post->getTitle() ?>
</a>
</li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>

The layout is nearly identical:
Expand Down
4 changes: 2 additions & 2 deletions book/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ Finally, create the corresponding template:
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
<?php if ($error): ?>
<div><?php echo $error->getMessage() ?></div>
<?php endif; ?>
<?php endif ?>

<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
<label for="username">Username:</label>
Expand Down Expand Up @@ -1803,7 +1803,7 @@ the built-in helper function:

<?php if ($view['security']->isGranted('ROLE_ADMIN')): ?>
<a href="...">Delete</a>
<?php endif; ?>
<?php endif ?>

.. note::

Expand Down
12 changes: 6 additions & 6 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ template - a text file parsed by PHP that contains a mix of text and PHP code:
<?php echo $item->getCaption() ?>
</a>
</li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>
</body>
</html>
Expand Down Expand Up @@ -233,7 +233,7 @@ First, build a base layout file:
<li><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
</ul>
<?php endif; ?>
<?php endif ?>
</div>

<div id="content">
Expand Down Expand Up @@ -283,7 +283,7 @@ A child template might look like this:
<?php foreach ($blog_entries as $entry): ?>
<h2><?php echo $entry->getTitle() ?></h2>
<p><?php echo $entry->getBody() ?></p>
<?php endforeach; ?>
<?php endforeach ?>
<?php $view['slots']->stop() ?>

.. note::
Expand Down Expand Up @@ -637,7 +637,7 @@ The ``recentList`` template is perfectly straightforward:
<a href="/article/<?php echo $article->getSlug() ?>">
<?php echo $article->getTitle() ?>
</a>
<?php endforeach; ?>
<?php endforeach ?>

.. note::

Expand Down Expand Up @@ -967,7 +967,7 @@ correctly:
)) ?>">
<?php echo $article->getTitle() ?>
</a>
<?php endforeach; ?>
<?php endforeach ?>

.. tip::

Expand Down Expand Up @@ -1141,7 +1141,7 @@ automatically:
<?php if ($app->getDebug()): ?>
<p>Request method: <?php echo $app->getRequest()->getMethod() ?></p>
<p>Application Environment: <?php echo $app->getEnvironment() ?></p>
<?php endif; ?>
<?php endif ?>

.. tip::

Expand Down
2 changes: 1 addition & 1 deletion book/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Inside the template, you can output the list of errors exactly as needed:
<ul>
<?php foreach ($errors as $error): ?>
<li><?php echo $error->getMessage() ?></li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>

.. note::
Expand Down
6 changes: 3 additions & 3 deletions cookbook/assetic/apply_to_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ templates:
array('coffee')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
<?php endforeach; ?>
<?php endforeach ?>

This is all that's needed to compile this CoffeeScript file and serve it
as the compiled JavaScript.
Expand Down Expand Up @@ -100,7 +100,7 @@ You can also combine multiple CoffeeScript files into a single output file:
array('coffee')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
<?php endforeach; ?>
<?php endforeach ?>

Both the files will now be served up as a single file compiled into regular
JavaScript.
Expand Down Expand Up @@ -186,4 +186,4 @@ being run through the CoffeeScript filter):
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>" type="text/javascript"></script>
<?php endforeach; ?>
<?php endforeach ?>
18 changes: 9 additions & 9 deletions cookbook/assetic/asset_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template:
array('@AcmeFooBundle/Resources/public/js/*')
) as $url): ?>
<script type="text/javascript" src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
.. note::

Expand Down Expand Up @@ -126,7 +126,7 @@ above, except with the ``stylesheets`` tag:
array('cssrewrite')
) as $url): ?>
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
<?php endforeach; ?>
<?php endforeach ?>
.. note::

Expand Down Expand Up @@ -178,7 +178,7 @@ To include an image you can use the ``image`` tag.
array('@AcmeFooBundle/Resources/public/images/example.jpg')
) as $url): ?>
<img src="<?php echo $view->escape($url) ?>" alt="Example" />
<?php endforeach; ?>
<?php endforeach ?>

You can also use Assetic for image optimization. More information in
:doc:`/cookbook/assetic/jpeg_optimize`.
Expand Down Expand Up @@ -231,7 +231,7 @@ but still serve them as a single file:
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
In the ``dev`` environment, each file is still served individually, so that
you can debug problems more easily. However, in the ``prod`` environment
Expand Down Expand Up @@ -268,7 +268,7 @@ combine third party assets, such as jQuery, with your own into a single file:
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
Using Named Assets
~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -341,7 +341,7 @@ with the ``@named_asset`` notation:
)
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
.. _cookbook-assetic-filters:

Expand Down Expand Up @@ -417,7 +417,7 @@ into your template:
array('uglifyjs2')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
A more detailed guide about configuring and using Assetic filters as well as
details of Assetic's debug mode can be found in :doc:`/cookbook/assetic/uglifyjs`.
Expand All @@ -444,7 +444,7 @@ done from the template and is relative to the public document root:
array('output' => 'js/compiled/main.js')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
.. note::

Expand Down Expand Up @@ -567,4 +567,4 @@ some isolated directory (e.g. ``/js/compiled``), to keep things organized:
array('output' => 'js/compiled/main.js')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
2 changes: 1 addition & 1 deletion cookbook/assetic/jpeg_optimize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ It can now be used from a template:
array('jpegoptim')
) as $url): ?>
<img src="<?php echo $view->escape($url) ?>" alt="Example"/>
<?php endforeach; ?>
<?php endforeach ?>

Removing all EXIF Data
~~~~~~~~~~~~~~~~~~~~~~
Expand Down
8 changes: 4 additions & 4 deletions cookbook/assetic/uglifyjs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ can configure its location using the ``node`` key:
.. code-block:: xml
<!-- app/config/config.xml -->
<assetic:config
<assetic:config
node="/usr/bin/nodejs" >
<assetic:filter
name="uglifyjs2"
Expand Down Expand Up @@ -172,7 +172,7 @@ your assets are a part of the view layer, this work is done in your templates:
array('uglifyj2s')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
.. note::

Expand Down Expand Up @@ -208,7 +208,7 @@ apply this filter when debug mode is off (e.g. ``app.php``):
array('?uglifyjs2')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
To try this out, switch to your ``prod`` environment (``app.php``). But before
you do, don't forget to :ref:`clear your cache <book-page-creation-prod-cache-clear>`
Expand Down Expand Up @@ -284,7 +284,7 @@ helper:
array('cssrewrite')
) as $url): ?>
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
<?php endforeach; ?>
<?php endforeach ?>
Just like with the ``uglifyjs2`` filter, if you prefix the filter name with
``?`` (i.e. ``?uglifycss``), the minification will only happen when you're
Expand Down
6 changes: 3 additions & 3 deletions cookbook/assetic/yuicompressor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ the view layer, this work is done in your templates:
array('yui_js')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
.. note::

Expand Down Expand Up @@ -130,7 +130,7 @@ can be repeated to minify your stylesheets.
array('yui_css')
) as $url): ?>
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo $view->escape($url) ?>" />
<?php endforeach; ?>
<?php endforeach ?>
Disable Minification in Debug Mode
----------------------------------
Expand All @@ -156,7 +156,7 @@ apply this filter when debug mode is off.
array('?yui_js')
) as $url): ?>
<script src="<?php echo $view->escape($url) ?>"></script>
<?php endforeach; ?>
<?php endforeach ?>
.. tip::

Expand Down
2 changes: 1 addition & 1 deletion cookbook/form/form_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ zero tags when first created).
<ul class="tags">
<?php foreach($form['tags'] as $tag): ?>
<li><?php echo $view['form']->row($tag['name']) ?></li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>
<?php echo $view['form']->end($form) ?>

Expand Down
6 changes: 3 additions & 3 deletions cookbook/form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ and customize the ``form_errors`` fragment.
<ul>
<?php foreach ($errors as $error): ?>
<li><?php echo $error->getMessage() ?></li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>
<?php endif ?>

Expand Down Expand Up @@ -860,11 +860,11 @@ fields (e.g. a whole form), and not just an individual field.
<ul>
<?php foreach ($errors as $error): ?>
<li><?php echo $error->getMessage() ?></li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>
<?php else: ?>
<!-- ... render the errors for a single field -->
<?php endif; ?>
<?php endif ?>
<?php endif ?>


Expand Down
2 changes: 1 addition & 1 deletion cookbook/security/form_login.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ redirect to the URL defined by some ``account`` route, use the following:
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
<?php if ($error): ?>
<div><?php echo $error->getMessage() ?></div>
<?php endif; ?>
<?php endif ?>

<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
<label for="username">Username:</label>
Expand Down
2 changes: 1 addition & 1 deletion cookbook/security/impersonating_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ to show a link to exit impersonation:
>
Exit impersonation
</a>
<?php endif; ?>
<?php endif ?>

Of course, this feature needs to be made available to a small group of users.
By default, access is restricted to users having the ``ROLE_ALLOWED_TO_SWITCH``
Expand Down
2 changes: 1 addition & 1 deletion cookbook/security/remember_me.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ might ultimately looks like this:
<!-- src/Acme/SecurityBundle/Resources/views/Security/login.html.php -->
<?php if ($error): ?>
<div><?php echo $error->getMessage() ?></div>
<?php endif; ?>
<?php endif ?>

<form action="<?php echo $view['router']->generate('login_check') ?>" method="post">
<label for="username">Username:</label>
Expand Down
2 changes: 1 addition & 1 deletion reference/forms/types/collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ A much more flexible method would look like this:
<?php echo $view['form']->errors($emailField) ?>
<?php echo $view['form']->widget($emailField) ?>
</li>
<?php endforeach; ?>
<?php endforeach ?>
</ul>

In both cases, no input fields would render unless your ``emails`` data array
Expand Down

0 comments on commit 5d6d0c2

Please sign in to comment.