philip Tue Jan 21 14:16:04 2003 EDT Modified files: /phpdoc/en/reference/url/functions get-meta-tags.xml Log: 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. Index: phpdoc/en/reference/url/functions/get-meta-tags.xml diff -u phpdoc/en/reference/url/functions/get-meta-tags.xml:1.1 phpdoc/en/reference/url/functions/get-meta-tags.xml:1.2 --- phpdoc/en/reference/url/functions/get-meta-tags.xml:1.1 Tue Jan 21 13:32:55 2003 +++ phpdoc/en/reference/url/functions/get-meta-tags.xml Tue Jan 21 14:16:03 2003 @@ -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>
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php