meta() public method

Create a meta tag that is output inline: $this->Html->meta('icon', 'favicon.ico'); Append the meta tag to custom view block "meta": $this->Html->meta('description', 'A great page', ['block' => true]); Append the meta tag to custom view block: $this->Html->meta('description', 'A great page', ['block' => 'metaTags']); Create a custom meta tag: $this->Html->meta(['property' => 'og:site_name', 'content' => 'CakePHP']); ### Options - block` - Set to true to append output to view block "meta" or provide custom block name.
public meta ( string | array $type, string | array | null $content = null, array $options = [] ) : string
$type string | array The title of the external resource
$content string | array | null The address of the external resource or string for content attribute
$options array Other attributes for the generated tag. If the type attribute is html, rss, atom, or icon, the mime-type is returned.
return string A completed `` element.
Ejemplo n.º 1
0
 /**
  * Creates a link to an external resource and handles basic meta tags.
  *
  * @param array|string $type
  * @param null $content
  * @param array $options
  * @return string
  */
 public function meta($type, $content = null, array $options = [])
 {
     return parent::meta($type, $content, $options) . $this->Document->eol;
 }
Ejemplo n.º 2
0
 /**
  * Creates a link to an external resource and handles basic meta tags
  * @param string|array $type The title of the external resource
  * @param string|array|null $content The address of the external resource
  *  or string for content attribute
  * @param array $options Other attributes for the generated tag. If the
  *  type attribute is html, rss, atom, or icon, the mime-type is returned
  * @return string A completed `<link />` element
  */
 public function meta($type, $content = null, array $options = [])
 {
     $options = $this->optionsDefaults(['block' => true], $options);
     return parent::meta($type, $content, $options);
 }