Skip to content
Closed
Changes from all 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
30 changes: 15 additions & 15 deletions book/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ persisted to the database. Writing in flat PHP is quick and dirty:
<ul>
<?php while ($row = $result->fetch(PDO::FETCH_ASSOC)): ?>
<li>
<a href="/show.php?id=<?php echo $row['id'] ?>">
<?php echo $row['title'] ?>
<a href="/show.php?id=<?= $row['id'] ?>">
<?= $row['title'] ?>
</a>
</li>
<?php endwhile ?>
Expand Down Expand Up @@ -113,8 +113,8 @@ is primarily an HTML file that uses a template-like PHP syntax:
<ul>
<?php foreach ($posts as $post): ?>
<li>
<a href="/show.php?id=<?php echo $post['id'] ?>">
<?php echo $post['title'] ?>
<a href="/show.php?id=<?= $post['id'] ?>">
<?= $post['title'] ?>
</a>
</li>
<?php endforeach ?>
Expand Down Expand Up @@ -205,10 +205,10 @@ that by creating a new ``layout.php`` file:
<!DOCTYPE html>
<html>
<head>
<title><?php echo $title ?></title>
<title><?= $title ?></title>
</head>
<body>
<?php echo $content ?>
<?= $content ?>
</body>
</html>

Expand All @@ -224,8 +224,8 @@ the layout:
<ul>
<?php foreach ($posts as $post): ?>
<li>
<a href="/show.php?id=<?php echo $post['id'] ?>">
<?php echo $post['title'] ?>
<a href="/show.php?id=<?= $post['id'] ?>">
<?= $post['title'] ?>
</a>
</li>
<?php endforeach ?>
Expand Down Expand Up @@ -280,11 +280,11 @@ the individual blog post:
<?php $title = $post['title'] ?>

<?php ob_start() ?>
<h1><?php echo $post['title'] ?></h1>
<h1><?= $post['title'] ?></h1>

<div class="date"><?php echo $post['created_at'] ?></div>
<div class="date"><?= $post['created_at'] ?></div>
<div class="body">
<?php echo $post['body'] ?>
<?= $post['body'] ?>
</div>
<?php $content = ob_get_clean() ?>

Expand Down Expand Up @@ -573,11 +573,11 @@ database and the Templating component to render a template and return a
<ul>
<?php foreach ($posts as $post): ?>
<li>
<a href="<?php echo $view['router']->path(
<a href="<?= $view['router']->path(
'blog_show',
array('id' => $post->getId())
) ?>">
<?php echo $post->getTitle() ?>
<?= $post->getTitle() ?>
</a>
</li>
<?php endforeach ?>
Expand All @@ -591,13 +591,13 @@ The layout is nearly identical:
<!DOCTYPE html>
<html>
<head>
<title><?php echo $view['slots']->output(
<title><?= $view['slots']->output(
'title',
'Default title'
) ?></title>
</head>
<body>
<?php echo $view['slots']->output('_content') ?>
<?= $view['slots']->output('_content') ?>
</body>
</html>

Expand Down