Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 60
Name: Michael
Location: Warsaw
Trades: 0
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 11:34 AM..
Korzonek is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-28-2008, 11:48 AM Re: meta tags and variables
Extreme Talker

Posts: 177
Trades: 0
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, 11:53 AM Re: meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 60
Name: Michael
Location: Warsaw
Trades: 0
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 12:41 PM..
Korzonek is offline
Reply With Quote
View Public Profile
 
Old 04-28-2008, 12:38 PM Re: meta tags and variables
Extreme Talker

Posts: 177
Trades: 0
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, 12:54 PM Re: meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 60
Name: Michael
Location: Warsaw
Trades: 0
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, 12:55 PM Re: meta tags and variables
soundousa1's Avatar
Average Talker

Posts: 15
Trades: 0
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, 01:04 PM Re: meta tags and variables
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
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 offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 04-28-2008, 01:12 PM Re: meta tags and variables
Korzonek's Avatar
Skilled Talker

Posts: 60
Name: Michael
Location: Warsaw
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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
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.37797 seconds with 12 queries