Skip to content

Commit c6af97f

Browse files
authored
Merge pull request #7918 from cakephp/ADmad-patch-1
Add example for generating meta tag with CSRF token
2 parents a4849a1 + 16a21af commit c6af97f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

en/views/helpers/html.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,11 @@ csrfToken The current CSRF token
149149

150150
.. code-block:: php
151151
152-
<?= $this->Html->meta(
152+
echo $this->Html->meta(
153153
'favicon.ico',
154154
'/favicon.ico',
155155
['type' => 'icon']
156156
);
157-
?>
158157
// Output (line breaks added)
159158
// Note: The helper code makes two meta tags to ensure the
160159
// icon is downloaded by both newer and older browsers
@@ -170,12 +169,11 @@ csrfToken The current CSRF token
170169
rel="shortcut icon"
171170
/>
172171
173-
<?= $this->Html->meta(
172+
echo $this->Html->meta(
174173
'Comments',
175174
'/comments/index.rss',
176175
['type' => 'rss']
177176
);
178-
?>
179177
// Output (line breaks added)
180178
<link
181179
href="http://example.com/comments/index.rss"
@@ -187,22 +185,24 @@ csrfToken The current CSRF token
187185
This method can also be used to add the meta keywords and
188186
descriptions. Example::
189187

190-
<?= $this->Html->meta(
188+
echo $this->Html->meta(
191189
'keywords',
192190
'enter any meta keyword here'
193191
);
194-
?>
195192
// Output
196193
<meta name="keywords" content="enter any meta keyword here" />
197194

198-
<?= $this->Html->meta(
195+
echo $this->Html->meta(
199196
'description',
200197
'enter any meta description here'
201198
);
202-
?>
203199
// Output
204200
<meta name="description" content="enter any meta description here" />
205201

202+
echo $this->Html->meta('csrfToken');
203+
// The CsrfProtection middleware must be loaded for your application
204+
<meta name="csrf-token" content="CSRF token here" />
205+
206206
In addition to making predefined meta tags, you can create link elements::
207207

208208
<?= $this->Html->meta([

0 commit comments

Comments
 (0)