Reputation: 2823
My scenario is such:
In my /views/layout/default.ctp
<head>
<!-- other stuff -->
<?php echo $scripts_for_layout; ?>
</head>
<body>
<!-- more stuff -->
<?php echo $content_for_layout; ?>
In my /views/pages/home.ctp
<?php $this->Html->meta('keywords', 'my, keywords', array(), false); ?>
However, my problem is that even with $scripts_for_layout
in my default.ctp, and with boolean inline = false
, I still can't see the meta
tag in my head
, instead I just see them inline.
I am considering the scenario that it $scripts_for_layout
is echoed before I make that HTML helper call, but surely there must be an elegant way to do this?
Also note that the HTML helper call is the first line to my views/pages/home.ctp
Edit - Aha I found my mistake. Here's to anybody else who's having the same problem. With CakePHP 1.3, the syntax for the HTML helper changes slightly (and there is no backwards-compatibility for the syntax).
Apparently there's a syntactical flaw in what I wrote in my view
.
This is the correct way to say boolean inline = false
in version 1.3:
$this->Html->meta("keywords", "keywords, are, sweet", array("inline" => false));
Upvotes: 4
Views: 8395
Reputation: 1175
For CakePHP version 3.x use this in your view:
<?php $this->Html->meta('keywords', 'keywords, are, sweet', ['block' => true]); ?>
Then in your layout's header use:
<?= $this->fetch('meta') ?>
The output will be:
<meta name="keywords" content="keywords, are, sweet"/>
Upvotes: 0
Reputation: 2823
Aha I found my mistake. Apparently there's a syntactical flaw in what I wrote in my view
.
This is the correct way to say boolean inline = false
in version 1.3:
$this->Html->meta("keywords", "keywords, are, sweet", array("inline" => false));
Upvotes: 2