Bug #14623 Updated: get_meta_tags only looks in begin of file
| From: | elixer@php.net | Date: | Sat, 22 Dec 2001 00:15:52 +0000 |
| Subject: | Bug #14623 Updated: get_meta_tags only looks in begin of file | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-74753@lists.php.net to get a copy of this message | ||
ID: 14623
Updated by: elixer
Reported By: jeroen@zwolnet.com
Status: Open
Bug Type: Strings related
Operating System: linux
PHP Version: 4.0.6
Assigned To: elixer
New Comment:
That example works fine here from the local CVS. I don't think it has anything to do with PHP
code being at the top of the page. My wager is that you have _useful_ code that is breaking
get_meta_tags, my guess is that the code contains the string "</head" in it somewhere.
Does this example piece of code actually not work on your setup? All it seems to do is waste memory
:)
Sean
Previous Comments:
------------------------------------------------------------------------
[2001-12-21 05:48:23] jeroen@zwolnet.com
The way I use it is quite different:
When a file is parsed it is 'wrapped': a prepended wrapper opens the file and layouts it.
Based on the meta tags a layout is choosen, menus added, header defined, etc.
This way the content exists out of plain HTML files that are build into the vieuwed pages when
parsed.
(That can differ for showing, printing, spiders, ... all with the same content - that is easy to
maintain even by dummies :).)
Jeroen.
------------------------------------------------------------------------
[2001-12-21 05:31:20] derick@php.net
Just a note... why would you want to do get_meta_tags on a non parsed file? I think it's makes
way more sense to use g_m_t on a parsed file.
Derick
------------------------------------------------------------------------
[2001-12-21 05:29:12] jeroen@zwolnet.com
<?
$s = "
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
... repeat this for about 110 lines of 80 'x'-es
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Failing get_meta_tags</title>
<META NAME="subject" CONTENT="mySubject">
<META NAME="keywords" CONTENT="myKeywords">
<link rel="stylesheet" href="mysheet.css">
</head>
<body>
GET_META_TAGS:
<?
print_r( get_meta_tags( $HTTP_SERVER_VARS["PATH_TRANSLATED"]));
?>
</body>
</html>
------------------------------------------------------------------------
[2001-12-20 19:34:44] elixer@php.net
Can you please provide me with a small example of a file that get_meta_tags is failing on? The only
time I am seeing this fail is if the text "</head" appears in the "working
code" that you mention.
Sean
------------------------------------------------------------------------
[2001-12-20 10:59:01] jeroen@zwolnet.com
get_meta_tags() seems to look only in the beginning of a file, meaning that e.g. if there is a lot
of PHP code before the HTML header it will return nothing ...
Tested using get_meta_tags() on local files with about 9000 characters of PHP code before HTML
HEADER.
Might be by design (speed), but then a warning is needed in doc: when adding working code, things
(get_meta_tags()) stop working ...
Workaround: if possible move code after header or if not include a file :(
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14623&edit=1