1

有人可以帮我解决这个技术 SEO 问题。在我们的网站上,我们有产品页面,其标题、描述(和关键字)标签是由进一步给定的 PHP 代码(函数)生成的。现在的问题是我们不希望父类别标题和描述出现(添加)在产品页面的相同元素(标题、描述)中。目前,父项以这种方式出现在每个产品页面标题和描述的开头:

产品页面标题标签: 父类标题标签-当前产品名称

产品描述标签: 父描述标签-“about_short”当前产品

我相信生成它的 PHP 函数是:

function get_seo() {
global $ln, $get_seo, $SEO, $f, $site_post;
function get_field($text, $field) {
    global $t_texts, $ln, $idp;
    $temp_idp=$idp;
    if (is_numeric($text)) {
        $r=$t_texts->select("id='$text' AND state<>'seo'");
        $f=mysql_fetch_array($r);
        //print_r($f);
        if (is_numeric($f[$field]))$text=$f[$field];
        else $text=ln($f[$field]);
        // parent add ///////////
        $add="";
        if($f["idp"]!=0) $add=ln($f["name"]);
        if ($add) {
            if(ln($f[$field]))
                $add="";
            $text .= $add;
        }
        $temp_idp=$f["idp"];
    }
    $text=trim(strip_tags(str_replace("&nbsp;", "", $text)));
    if ($field!="title") $text=str_replace("\"", "", $text);
    //if $text is not empty return $text;
    if (strlen($text)>2) return $text;
        else { return ($temp_idp) ? get_field($temp_idp, $field): false; }
}

$arr = explode(" ", "title description keywords");
for ($i=0; $i<count($arr); $i++) {
    $mas = $arr[$i];
    if (ln($f[$mas]))
         $SEO[$mas] = ln($f[$mas]);
    else {
        if ($temp=get_field($get_seo[$mas], $mas)) $temp=", $temp";
        $SEO[$mas] = ln($f["name"]).$temp;
    }
}
if (!$t_texts) $t_texts = new mysql("texts$site_post");
if (($f["module_id"]==855)&&(intval($_GET['id'])>0)) {
    $r = $t_texts->query("SELECT * FROM `projects` where id='".(int)$_GET['id']."' limit 1");
    $f2 = mysql_fetch_array($r);
    $SEO['title']  .= (ln($f2['name']))?' - '.htmlspecialchars(ln($f2['name'])):'';
    $SEO['description']  .= (ln($f2['about_short']))?' - '.htmlspecialchars(ln($f2['about_short'])):'';
}

}

我需要的是:

产品页面标题标签:当前产品名称

产品页面描述: “about_short”当前产品

并且类别标题和描述保持不变,但只出现在这些类别页面中(而不是在产品中)。

我已经尽量说清楚了,但是如果您对编码或相关内容有任何进一步的问题,我很乐意提供。

谢谢你们的帮助!

4

0 回答 0