PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 25, 2022

[FIXED] Using Meta Description in the right place CakePHP 3

 January 25, 2022     cakephp, cakephp-3.x, head, metadata, smarty     No comments   

Issue

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?


Solution

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');
?


Answered By - Salines
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing