Home  >  Article  >  Web Front-end  >  How to replace the default meta tag in "layout" with a custom meta tag in "view" with HTML?

How to replace the default meta tag in "layout" with a custom meta tag in "view" with HTML?

WBOY
WBOYforward
2023-09-10 14:57:02834browse

How to replace the default meta tag in layout with a custom meta tag in view with HTML?

Meta tags are used to store data about an HTML document, such as the author and description of the document.

The best solution is to define the default label in the application and override the default parameters in the view. We can do this in PHP.

First make changes in the configuration file −

<?php
return [  
   &lsquo;addemailid&rsquo; =>&rsquo; demo@example.com&rsquo;,  
   &lsquo;descrip&rsquo;=>&rsquo;docdescription&rsquo;
];

Make layout changes −

<?php
   $this->registerMetaTag($app->params[&lsquo;ademailid&rsquo;], &lsquo;ademailid&rsquo;);
   $this->registerMetaTag($app->params[&lsquo;descrip&rsquo;],&rsquo; descrip&rsquo;);
?>

The above is the detailed content of How to replace the default meta tag in "layout" with a custom meta tag in "view" with HTML?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete