Php 将我的标签链接到其他网站搜索
这是我的搜索码Php 将我的标签链接到其他网站搜索,php,search,hyperlink,tags,Php,Search,Hyperlink,Tags,这是我的搜索码 <div id="search"> <form method="get" action="http://www.other-website.com/search"> <input type="hidden" name="f" value=""> <input type="text" placeholder="Temukan informasi, komunitas & produk yang
<div id="search">
<form method="get" action="http://www.other-website.com/search">
<input type="hidden" name="f" value="">
<input type="text" placeholder="Temukan informasi, komunitas & produk yang kamu cari disini" accesskey="s" name="q">
<input type="submit" value="Search">
</form>
</div>
这是标签代码(仅显示文本“请勿链接”)
该代码可以应用在网站上,但我必须输入文本搜索。我只想把我的标签放在搜索文本上
所以我的问题是
如何使固定词(我的标签)自动放置在搜索或我必须放置标签代码的位置,搜索结果是链接在@www.other-website.com/search上的mytag,以便用户不必键入?我想在其他网站搜索中搜索我的标签一个简单的方法是从输入搜索查询的文本框中获取值,然后使用
onsubmit()
创建一个javascript函数
var searchkeyword=document.forms[“formname”][“textboxname/id”].value代码>
window.location(“www.othersite.com/”+搜索关键字)代码>经过一夜的尝试和出错,我想我找到了它,下面是代码的详细信息:
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$tag_link = 'http://xxx.orhersite.xxx';
echo "<a href='$tag_link/$tag->name'>";
echo "$tag->name";
}
} ?>
我不明白你在说什么。@ganeshrj谢谢,你是如何将你的应用到我的上的,对不起,因为我对编码没有经验。:)请把你所做的事情的代码发给我,这样我可以给你提建议。你得到答案了吗?对于新选项卡
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$tag_link = 'http://xxx.orhersite.xxx';
echo "<a href='$tag_link/$tag->name'>";
echo "$tag->name";
}
} ?>
echo "<a href onclick="window.open('');
<?php
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
$tag_link = 'http://xxx.orhersite.xxx';
echo "<a href onclick="window.open('$tag_link/$tag->name')">";
echo "$tag->name";
}
} ?>