Old 9th June 2013, 06:02   #1
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Question about XHTML and meta tag

This is my sample page:
code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="Generator" content="Geany 1.23.1" />
<meta name="author" content="Joel Almeida Garc&iacute;" />
<meta name="Date" content="06.06.2013 14:09:08" />
<meta name="Robots" content="NOINDEX, NOFOLLOW" />
<link href="data/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="data/favicon.png" />
<script type="text/javascript" src="data/js.js" charset="UTF-8"></script>
<title>Ciencias de la comunicaci&oacute;n II</title>
</head>
<body>
<p>Here goes date:</p> <!-- here goes meta name="Date" contents -->
</body>
</html>


My question is: Is it possible to show any of the meta tags info into the body of the page? For example show "Date"


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 9th June 2013, 17:51   #2
Smeggle
Just Strolling By
(Major Dude)
 
Smeggle's Avatar
 
Join Date: Aug 2002
Location: A Long Winding Road.....
Posts: 3,250
Quote:
Originally Posted by Joel View Post
This is my sample page:
code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="Generator" content="Geany 1.23.1" />
<meta name="author" content="Joel Almeida Garc&iacute;" />
<meta name="Date" content="06.06.2013 14:09:08" />
<meta name="Robots" content="NOINDEX, NOFOLLOW" />
<link href="data/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="data/favicon.png" />
<script type="text/javascript" src="data/js.js" charset="UTF-8"></script>
<title>Ciencias de la comunicaci&oacute;n II</title>
</head>
<body>
<p>Here goes date:</p> <!-- here goes meta name="Date" contents -->
</body>
</html>


My question is: Is it possible to show any of the meta tags info into the body of the page? For example show "Date"
never seen it myself and btw .. title goes first not at the end

Music is Life, Love and Happiness :|: Life is Music. Serren - 1985 - 2005
Religion? Religion is a Blasphemy against humanity - From the film What the Bleep do we know

siggy link So stumbling? whats it all about
Smeggle is offline   Reply With Quote
Old 9th June 2013, 23:39   #3
rockouthippie
Banned
 
rockouthippie's Avatar
 
Join Date: Jun 2004
Location: Oregon
Posts: 11,002
You'd have to use php

http://php.net/manual/en/function.get-meta-tags.php
rockouthippie is offline   Reply With Quote
Old 9th June 2013, 23:39   #4
iomegajaz
Balled and Chained
Alumni
 
Join Date: Jun 2000
Posts: 5,237
Does this help?

http://stackoverflow.com/questions/1...t-on-a-webpage

"My heart hates uggos." –J.D.
iomegajaz is offline   Reply With Quote
Old 10th June 2013, 06:16   #5
ryan
not fucked, not quite.
(Forum King)
 
ryan's Avatar
 
Join Date: Feb 2002
Location: Tn
Posts: 8,798
Send a message via AIM to ryan
This page could be useful.
ryan is offline   Reply With Quote
Old 10th June 2013, 18:19   #6
QOAL
[STILL a retard!]
 
QOAL's Avatar
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 1,168
code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="Generator" content="Geany 1.23.1" />
<meta name="author" content="Joel Almeida Garc&iacute;" />
<meta name="Date" content="06.06.2013 14:09:08" />
<meta name="Robots" content="NOINDEX, NOFOLLOW" />
<link href="data/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="data/favicon.png" />
<script type="text/javascript" src="data/js.js" charset="UTF-8"></script>
<script type="text/javascript">
//<![CDATA[
window.onload = function() {
document.getElementById('metaDate').innerHTML = document.getElementsByName('Date')[0].content; //You could use .textContent (There is .innerText for ie though)
}
//]]>
</script>
<title>Ciencias de la comunicaci&oacute;n II</title>
</head>
<body>
<p id="metaDate">Here goes date:</p>
</body>
</html>


count!last.fmdastylishplanner
QOAL is online now   Reply With Quote
Old 11th June 2013, 00:18   #7
rockouthippie
Banned
 
rockouthippie's Avatar
 
Join Date: Jun 2004
Location: Oregon
Posts: 11,002
Output the date metadata for the current page:

<p>The meta date is:</p><?php $tags = get_meta_tags("http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
echo $tags['date'];?>
rockouthippie is offline   Reply With Quote
Old 11th June 2013, 00:58   #8
ryan
not fucked, not quite.
(Forum King)
 
ryan's Avatar
 
Join Date: Feb 2002
Location: Tn
Posts: 8,798
Send a message via AIM to ryan
Quote:
Originally Posted by QOAL View Post
...
...
...
I was thinking something like that but it's been so long I couldn't remember. Kudos!
ryan is offline   Reply With Quote
Old 11th June 2013, 14:58   #9
QOAL
[STILL a retard!]
 
QOAL's Avatar
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 1,168
Quote:
Originally Posted by rockouthippie View Post
Output the date metadata for the current page:

<p>The meta date is:</p><?php $tags = get_meta_tags("http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
echo $tags['date'];?>
Why would you do it that way? That looks really slow and inefficient.

You may as well just use php to define some vars before you output the page, then reference them as you spit it out.

code:
<?php $metaDate = '06.06.2013 14:09:08'; ?><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="Generator" content="Geany 1.23.1" />
<meta name="author" content="Joel Almeida Garc&iacute;" />
<meta name="Date" content="<?php echo $metaDate; ?>" />
<meta name="Robots" content="NOINDEX, NOFOLLOW" />
<link href="data/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="data/favicon.png" />
<script type="text/javascript" src="data/js.js" charset="UTF-8"></script>
<title>Ciencias de la comunicaci&oacute;n II</title>
</head>
<body>
<p><?php echo $metaDate; ?></p>
</body>
</html>


count!last.fmdastylishplanner
QOAL is online now   Reply With Quote
Old 11th June 2013, 15:04   #10
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
@QOAL: helps


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 11th June 2013, 17:32   #11
rockouthippie
Banned
 
rockouthippie's Avatar
 
Join Date: Jun 2004
Location: Oregon
Posts: 11,002
Quote:
Originally Posted by QOAL View Post
Why would you do it that way? That looks really slow and inefficient.

You may as well just use php to define some vars before you output the page, then reference them as you spit it out.
Why would you need to know what the metadata was if you already knew? Other php makes the metadata. You need to read it out. i.e.... in wordpress. The post will write the metadata. If you want to use it, you'll need to read it out or get the data more directly from the database.

Put this in the body of a wordpress ( d r u p a l, joomla etc.)page:

<strong><p>Post date:</p><?php $tags = get_meta_tags("http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
echo $tags['date'];?><br>
<p>Post author:</p><?php $tags = get_meta_tags("http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]);
echo $tags['author'];?><br></strong>

Post date:06.06.2013 14:09:08
Post author:rockouthippie
rockouthippie is offline   Reply With Quote
Old 11th June 2013, 19:59   #12
QOAL
[STILL a retard!]
 
QOAL's Avatar
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 1,168
I'm just dealing with the exact problem that Joel posted, nothing else. I'm not concerned about other websites.

Most CMS type sites have an API where you can fetch this information. (For wordpress: http://codex.wordpress.org/Function_Reference/)
And if it's not available then just go in and extend stuff (cleanly) so you can get it.
The cost of doing this is smaller than fetching and parsing the page, especially if the requested page is not cached.

You're also making two requests with that example, so it'll be even slower.
Not that it matters because you are creating an infinite loop!
The page that is being generated is fetching itself (to get the meta data) which in turn is... fetching itself...
Try it yourself by using Joel's example as a base page.

count!last.fmdastylishplanner
QOAL is online now   Reply With Quote
Old 15th June 2013, 23:05   #13
rockouthippie
Banned
 
rockouthippie's Avatar
 
Join Date: Jun 2004
Location: Oregon
Posts: 11,002
Quote:
you are creating an infinite loop!
I was looking for a generic solution. That does make a loop. I didn't think of it.

OK... so get_post_meta as a Wordpress function. getMetaData in Joomla. You've got to gyrate a little to get it out of D r u p a l.
rockouthippie is offline   Reply With Quote
Old 16th July 2013, 20:38   #14
BobXFett
Junior Member
 
Join Date: Dec 2004
Location: South Carolina
Posts: 17
Send a message via AIM to BobXFett
w3schools also has some good links

Simplicity in all things.
BobXFett is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Community Center > General Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump