PHP within HTML iFrame
| From: | Andrew G | Date: | Tue, 22 Apr 2003 22:15:29 +0000 |
| Subject: | PHP within HTML iFrame | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144915@lists.php.net to get a copy of this message | ||
I am trying to devise a way to create meta-tag keywords dynamically with
javascript or PHP, but the catch is I need to retain the files original
extension of '.html'
I have done a PHP sendmail app using an iFrame successfully, so i was
wondering (outloud) if the same thing could work for this.
I did a nice javascript routine (below) before I realized that
'document.write(keywords);' does me no good for search-engines (or does
it?), because I need the keywords to appear in the source code. So, does
anyone have any opinions about how to do this? Is there any merit to my
iFrame idea? Is there a such thing as a PHP include within an .html file?
Thanks anyone and everyone!
<script language="JavaScript">
//create keywords from title
var title = "[-- PRODUCT.name REMOVE_HTML --]"; // this is a variable spit
out by my shopping cart when the html page is generated
var keys = new Array();
var stringEnd = title.lastIndexOf(" ");
i = 0;
firstChar = 0;
lastChar = 0;
while(lastChar < stringEnd) {
lastChar = title.indexOf(" ", firstChar);
lastChar -= 1;
keys[i] = title.subString(firstChar, lastChar);
firstChar = lastChar + 2;
i += 1;
}
var newKeywords = "";
for (var i = 0; i < keys.length; i++) {
newKeywords = newKeywords + ", " + keys[i];
}
document.write("<meta name='keywords' content='" + newKeywords +
newKeywords + "TIVO,Television,Plasma,digital camera,camcorders,Polk
Audio,home theater,projection,speaker,reciever,DVD,VCR,MP3'>");
</script>