Reply
meta tags and variables
Old 04-28-2008, 10:31 AM meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 51
Name: Michael
Location: Warsaw
Is it possible to put a variable in meta tags??

PHP Code:
$file =fopen("$dt/$name","a");

fwrite($file,'
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">    
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />

/*this is a script that creates a new page ($name) . This a standard  header for the new page created  via form.  "$tag" is a variable wich contains keywords but when I view the page in the key word section I get only $tag insted of words from $tag variable wich are posted via form. I know I can echo variables inside body but is it possible inside head??*/
 
<META NAME="Keywords" CONTENT="<?php  echo $tag;?>"/>
<title>Barmania TechSite</title>
<link rel="stylesheet" href="css/index.css" type="text/css"/>
</head>
<body>
saaasass
</body>
</html>

');

fflush($file);
?>

Last edited by Korzonek : 04-28-2008 at 10:34 AM.
Korzonek is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 04-28-2008, 10:48 AM Re: meta tags and variables
Skilled Talker

Posts: 91
Yes it's definitely possible, but you might want to put the variable into a session variable so it will have a value when echo'ing. Also make sure session_start() is at the top of the pages.
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 04-28-2008, 10:53 AM Re: meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 51
Name: Michael
Location: Warsaw
any hints or links how to that??


I've tried that but still there is a problem...I havent got a clue how to make it work. And still my script creates a new page with ale those things so i would have to put two sesions in one doc...

Last edited by Korzonek : 04-28-2008 at 11:41 AM.
Korzonek is offline
Reply With Quote
View Public Profile
 
Old 04-28-2008, 11:38 AM Re: meta tags and variables
Skilled Talker

Posts: 91
I'm not sure where $tag is coming from, but wherever that is set, use $_SESSION['tag'] = $tag or however you want set the tag variable. And at the top of the pages, before anything, make a php code section:
PHP Code:
<?php session_start(); ?>
Heres some information on sessions and should help you get started:
http://w3schools.com/php/php_sessions.asp

Hope this helps
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 04-28-2008, 11:54 AM Re: meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 51
Name: Michael
Location: Warsaw
I've tried that but still not working. I think it's because this script creates a whole new php file and the html is writen in :fwrite($file,'HTML CODE'); so even if i'll put <?php ?>
and start the session it is stil not working
Korzonek is offline
Reply With Quote
View Public Profile
 
Old 04-28-2008, 11:55 AM Re: meta tags and variables
soundousa1's Avatar
Novice Talker

Posts: 14
I think that (in SEO) write the content of your meta tags is better than put the variables inside..
soundousa1 is offline
Reply With Quote
View Public Profile
 
Old 04-28-2008, 12:04 PM Re: meta tags and variables
VirtuosiMedia's Avatar
Webmaster Talker

Posts: 599
One of the reasons it probably isn't working is that you are creating a brand new file, but there is no PHP that defines what the $tag variable actually is. At some point in your file, you'll need to get $tag's value from the database or a GET or POST value.
VirtuosiMedia is online now
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 04-28-2008, 12:12 PM Re: meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 51
Name: Michael
Location: Warsaw
yes, but I wan to make a form wich creates new pages with some content. And I dont know any other way to pass the content from form to a new page, then via php script and variables . Also I have to make a search engine so I need to be able put some key words inthose new pages...
Korzonek is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to meta tags and variables
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14179 seconds with 13 queries