Isengo Isengo - 4 months ago 26
Smarty Question

Using Meta Description in the right place CakePHP 3

I am trying to use meta tags and description in cakephp 3. It is working so far, but I am facing the problem that I can´t put it in the of my page, because my .ctp files are rendered in my default.ctp

So for example I have my menu, footer etc. in my default.ctp and my page for the faq is in the faq.ctp How can I push those

<?php
echo $this->Html->meta('description','enter any meta description here');
?>


metadescription in the head tag? Do I need a template language like smarty and use blocks?

Answer

In layout:

<?php
echo $this->Html->meta('description',$description);
?

in your faq.ctp or faq() method:

<?php
$this->set('description','enter any meta description here');
?
Comments