Home > Web Front-end > HTML Tutorial > 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
Release: 2023-09-10 14:57:02
forward
864 people have browsed it

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;
];
Copy after login

Make layout changes −

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

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!

source:tutorialspoint.com
Previous article:HTML5 Geolocation "Permission Denied" Error in Mobile Safari Next article:How to specify in HTML the HTML content of a page to be displayed in an