Jump to content

dynamic Meta Tags


pcbytes

Recommended Posts

I can't seem to get the dynamic meta tags to work on my site. I am loading a remote page into index.php, and the $meta variable on the remote page has the description I want to load into index.php

 

index.php meta tag.

<meta name="description" content="<?php $_GET[$meta]; ?>">

 

index.php dynamic page load

<?php
$page = $_GET['page'];
urlencode($page);

if($page > "")
{
	include($page);
}

Else		//if page just loads and no "page=" variable set show main page
{
	include('dynamic_page');
} 
?> 

 

remote file being dynamically loaded

<?php
$meta = "An informative article about food";
?> 

<h1> bla bla bla content here bla bla bla</h1>

 

 

Link to comment
https://forums.phpfreaks.com/topic/46203-dynamic-meta-tags/
Share on other sites

I'm not exactly sure what you want to do but I have dynamic meta tags and it works for me.

 

<html>
<?php include('meta.php') ?>
<body>
blah blah
</body>
</html>

 

Now make the meta.php file to be in the same file directory (or change that) and have it read this:

 

<head>
<title>
Page Title
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Description of page here">
<meta name="keywords" content="Keywords here">
</head>

 

It works for me.

Link to comment
https://forums.phpfreaks.com/topic/46203-dynamic-meta-tags/#findComment-224612
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.