I run a small search engine and adding URL's is a bit of a pain so I thought
I would try to make it easier. Looking around I found a PHP function called
"get_meta_tags" which unsurprisingly, grabs the contents of varoius meta
tags. I just want the "description" contents so I first made a standalone
PHP page (http://www.yorkshire-search.co.uk/links/meta-tags.php3) which
performs get_meta_tags and uses $PHP_SELF so output is displayed on a page
with the same name. Check it out and you see that works fine (was a slight
problem if no initial URL value set).

However, the search engine uses HTML templates and that is where my problem
is.

Within the orginal form (add_form.html) was just HTML so I deleted that and
put the above working code between <php></php> tags to generate a form.
WhenI uploaded it and then entered the page, the form displayed OK but when
I
press "generate meta tags" it refuses to output the results into the boxes.
The search engine manual says you can place PHP code within templates as
long as they are within <php></php> tags so I am now at a bit of loss.

This is the add_form.html template if anyone is interested.

<p class="ptitle">Add Link</p>
<table width="500" border="0" cellpadding="5">
<tr>
<td colspan="3">
<center>
<font face="Arial" size="2" color="Red"><%error_msg%></font>
</center>

<php>

if ($action == "generate")
{
print "<P>Insert the following HTML code between the &lt;HEAD&gt; tags of
your site:";
print "<FORM><TEXTAREA ROWS=8 COLS=60>&LT;META NAME=\"description\"
CONTENT=\"$desc\"&GT;\n";
print "&LT;META NAME=\"keywords\" CONTENT=\"$keyw\"&GT;\n";
if ($robots == "yes")
{
print "&LT;META NAME=\"robot\" CONTENT=\"$robotsoption\"&GT;\n";
}
if ($refresh == "yes")
{
print "&LT;META NAME=\"refresh\" CONTENT=\"$refreshafter\"&GT;\n";
}
if ($copyright == "yes")
{
print "&LT;META NAME=\"copyright\" CONTENT=\"$copyrighttext\"&GT;\n";
}
if ($author == "yes")
{
print "&LT;META NAME=\"author\" CONTENT=\"$authorname\"&GT;\n";
}
if ($generator == "yes")
{
print "&LT;META NAME=\"generator\" CONTENT=\"$generatorname\"&GT;\n";
}
if ($language == "yes")
{
print "&LT;META NAME=\"language\" CONTENT=\"$languagetype\"&GT;\n";
}
if ($revisit == "yes")
{
print "&LT;META NAME=\"revisit-after\" CONTENT=\"$revisitdays\"&GT;\n";
}
print "</TEXTAREA></FORM>";
print "<A HREF=\"$PHP_SELF\">Create another set of meta tags</A><P>";


}
else
{
if (isset($getmetafrompage))
{
$MetaTags = get_meta_tags($getmetafrompage);
}
$description = $MetaTags["description"];
$keywords = $MetaTags["keywords"];
$robot = $MetaTags["robot"];
$author = $MetaTags["author"];
$refresh = $MetaTags["refresh"];
$copyright = $MetaTags["copyright"];
$revisit = $MetaTags["revisit-after"];
$generator = $MetaTags["generator"];
$language = $MetaTags["language"];

$year = date('y');
print "<FORM ACTION=\"$PHP_SELF\" METHOD=post>";
print "If your page already has META tags you may import and edit
them.<BR>";
print "<B>URL:</B> <INPUT TYPE=text NAME=getmetafrompage SIZE=30
VALUE=\"http://\";><BR>";
print "<INPUT TYPE=submit VALUE=\"Import META tags from page\"
class=\"button\"></FORM><HR>";

print "<form action=\"add.php3\" method=post>";
print "<input type=hidden name=pflag value=add>";
print "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\"
width=\"100%\"><tr> <td><font face=\"Arial\"
size=\"2\">Title</font></td><td>";
print "<input type=text name=title size=40></td></tr><tr><td><font
face=\"Arial\" size=\"2\">Url</font></td><td>";
print "<input type=text name=url size=40
echo=\"$getmetafrompage\"></td></tr><tr><td valign=\"top\"><font
face=\"Arial\" size=\"2\">Description</font></td><td>";
print "<textarea name=\"description\" cols=40 rows=10 maxlength=255
wrap=virtual VALUE=\"$description\"></textarea>";
print "</td></tr><tr><td><font face=\"Arial\"
size=\"2\">Category</font></td><td><font face=\"Arial\"
size=\"2\"><%category%></font></td></tr><tr><td><font face=\"Arial\"
size=\"2\">Contact Name</font></td><td>";
print "<input type=text name=contact_name size=30></td></tr><tr><td><font
face=\"Arial\" size=\"2\">Email</font></td><td><input type=text name=email
size=30></td></tr><tr><td><font face=\"Aria\"
size=\"2\">Bid</font></td><td>";
print "<input type=text name=bid size=10><font face=\"Arial\" size=\"2\"
color=\"green\">(optional)</font></td></tr><tr><td>&nbsp;</td><td><input
type=submit name=submit value=\"Add\"
class=\"button\"></td></tr></table></form>";
}

</php>

</td>
</tr>
</table>





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to