mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
A major rewrite. Implement user comments such as "if same name, last is returned",
"note that as of 4.0.5 unquoted attributes are supported", and lowercasing. Wrote an example to demonstrate various points such as . to _ in keys. Moved use_include_path info to the top, said it's not used with urls and also mentioned and linked to include_path. See also htmlentities and urlencode. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@112969 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
e7feaba4e5
commit
5e78de3943
1 changed files with 46 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.get-meta-tags">
|
||||
<refnamediv>
|
||||
|
@ -18,13 +18,25 @@
|
|||
</methodsynopsis>
|
||||
<para>
|
||||
Opens <parameter>filename</parameter> and parses it line by line
|
||||
for <meta> tags of the form
|
||||
for <meta> tags in the file. This can be a local file or
|
||||
an <acronym>URL</acronym>. The parsing stops at
|
||||
<literal></head></literal>.
|
||||
</para>
|
||||
<para>
|
||||
Setting <parameter>use_include_path</parameter> to 1 will result
|
||||
in PHP trying to open the file along the standard include path
|
||||
as per the <link linkend="ini.include-path">include_path</link>
|
||||
directive. This is used for local files, not URLs.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Meta Tags Example</title>
|
||||
<title>What <function>get_meta_tags</function> parses</title>
|
||||
<programlisting role="html">
|
||||
<![CDATA[
|
||||
<meta name="author" content="name">
|
||||
<meta name="tags" content="php3 documentation">
|
||||
<meta name="keywords" content="php documentation">
|
||||
<meta name="DESCRIPTION" content="a php manual">
|
||||
<meta name="geo.position" content="49.33;-86.59">
|
||||
</head> <!-- parsing stops here -->
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@ -38,11 +50,38 @@
|
|||
can easily use standard array functions to traverse it or access
|
||||
single values. Special characters in the value of the name
|
||||
property are substituted with '_', the rest is converted to lower
|
||||
case.
|
||||
case. If two meta tags have the same name, only the last one
|
||||
is returned.
|
||||
</para>
|
||||
<para>
|
||||
Setting <parameter>use_include_path</parameter> to 1 will result
|
||||
in PHP trying to open the file along the standard include path.
|
||||
<example>
|
||||
<title>What <function>get_meta_tags</function> returns</title>
|
||||
<programlisting="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// Assuming the above tags are at example.com
|
||||
$tags = get_meta_tags('http://www.example.com/');
|
||||
|
||||
// Notice how the keys are all lowercase now, and
|
||||
// how . was replaced by _ in the key.
|
||||
print $tags['author']; // name
|
||||
print $tags['keywords']; // php documentation
|
||||
print $tags['description']; // a php manual
|
||||
print $tags['geo_position']; // 49.33;-86.59
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
As of PHP 4.0.5, <function>get_meta_tags</function> supports
|
||||
unquoted html attributes.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <function>htmlentities</function> and
|
||||
<function>urlencode</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
|
Loading…
Reference in a new issue