@xpx said:
Nessuno sa come posso fare?? E' un problema avere lo stesso titolo per 20 pagine!
Si può fare. Se non hai risolto basta chiedere
Cmq è un settaggio/script che è da inserire in includes/meta.php e da aggiungere un file extra che comprende i parametri.
Mi spiego meglio:
- In includes salva il file** dynamic_tittes.php **con il seguente codice:
<?php
/********************************************************************/
/* SN Dynamic Titles Addon */
/* =========================== */
/* Copyright (c) 2003 by Greg Schoper */
/* http://nuke.schoper.net */
/* */
/* Based on code from PHP-Nuke */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or */
/* modify it under the terms of the GNU General Public License as */
/* published by the Free Software Foundation; either version 2 of */
/* the License. */
/********************************************************************/
/* Credit to unknown author of original forums code in */
/* includes/dynamic_titles.php. */
/********************************************************************/
/* Updated for better SEO results using storebuilders suggestions */
/* sixonetonoffun http://www.netflake.com */
/********************************************************************/
if (eregi("dynamic_titles.php",$_SERVER['SCRIPT_NAME'])) {
Header("Location: index.php");
die();
}
// Item Delimeter
$item_delim = "";
$newpagetitle = "";
global $name;
include ("config.php");
include("db/db.php");
// Forums
if($name=="Forums"){
global $p,$t,$forum,$f;
$newpagetitle = "Nome del tuo Sito - $item_delim $name";
$newpagetitle = preg_replace("/[(\S+)]/e", "", $newpagetitle);
$newpagetitle = check_html($newpagetitle, nohtml);
if($p) {
$p = intval($p);
$sql = "SELECT post_subject, post_id, post_text FROM ".$prefix."_bbposts_text WHERE post_id='$p'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$title = $row[post_subject];
$post = $row[post_id];
$ptext = $row[post_text];
$newpagetitle = "Nome del tuo Sito :: $title $item_delim $ptext";
$newpagetitle = preg_replace("/[(\S+)]/e", "", $newpagetitle);
$newpagetitle = check_html($newpagetitle, nohtml);
}
if($t) {
$t = intval($t);
$sql = "SELECT topic_first_post_id FROM ".$prefix."_bbtopics WHERE topic_id='$t'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$tpid = $row[topic_first_post_id ];
$sql = "SELECT post_subject, post_id, post_text FROM ".$prefix."_bbposts_text WHERE post_id='$tpid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$title = $row[post_subject];
$post = $row[post_id];
$ptext = $row[post_text];
$newpagetitle = "Nome del tuo Sito :: $title $item_delim $ptext";
$newpagetitle = preg_replace("/[(\S+)]/e", "", $newpagetitle);
$newpagetitle = check_html($newpagetitle, nohtml);
}
elseif($f) {
$f = intval($f);
$sql = "SELECT forum_name FROM ".$prefix."_bbforums WHERE forum_id='$f'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$forum = $row[forum_name];
$newpagetitle = "Nome del tuo Sito $item_delim $forum";
$newpagetitle = preg_replace("/[(\S+)]/e", "", $newpagetitle);
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// News
if($name=="News"){
global $file,$sid,$new_topic, $slogan;
$newpagetitle= "Nome del tuo Sito ";
$newpagetitle = check_html($newpagetitle, nohtml);
if ($new_topic!=""){
$sql = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$top = $row[topictext];
$newpagetitle= "Nome del tuo Sito $top";
$newpagetitle = check_html($newpagetitle, nohtml);
}
if ($file=="article"){
$sql = "SELECT title, topic FROM ".$prefix."_stories WHERE sid='$sid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$art = $row[title];
$top = $row[topic];
$sql = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$top'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$top = $row[topictext];
$newpagetitle= "Nome del tuo Sito :: $top - $item_delim $art";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Articles
if($name=="Articles"){
global $file,$sid,$new_topic, $slogan;
$newpagetitle= "Nome del tuo Sito :: $item_delim $item_delim $name";
$newpagetitle = check_html($newpagetitle, nohtml);
if ($new_topic!=""){
$sql = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$top = $row[topictext];
$newpagetitle= "Nome del tuo Sito :: $top";
$newpagetitle = check_html($newpagetitle, nohtml);
}
if ($file=="article"){
$sql = "SELECT title, topic FROM ".$prefix."_stories WHERE sid='$sid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$art = $row[title];
$top = $row[topic];
$sql = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$top'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$top = $row[topictext];
$newpagetitle= "Nome del tuo Sito :: $top - $item_delim $art";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Topics
if($name=="Topics"){
$newpagetitle = "Nome del tuo Sito :: "._ACTIVETOPICS."";
$newpagetitle = check_html($newpagetitle, nohtml);
}
// Dating
if($name=="Dating"){
$newpagetitle = "Nome del tuo Sito $name";
$newpagetitle = check_html($newpagetitle, nohtml);
}
// Downloads
if($name=="Downloads"){
global $d_op,$cid,$lid;
$newpagetitle = "Nome del tuo Sito :: $item_delim $name";
$newpagetitle = check_html($newpagetitle, nohtml);
if($d_op=="viewdownload") {
$sql = "SELECT title, parentid FROM ".$prefix."_downloads_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$parent = $row[parentid];
if($parent=="0"){
$newpagetitle = "Nome del tuo Sito :: $cat";
$newpagetitle = check_html($newpagetitle, nohtml);
}
else{
$sql = "SELECT title FROM ".$prefix."_downloads_categories WHERE cid='$parent'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$parent = $row[title];
$newpagetitle = "Nome del tuo Sito :: $parent $item_delim $cat";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
if($d_op=="viewdownloaddetails" || $d_op=="getit") {
$sql = "SELECT title FROM ".$prefix."_downloads_downloads WHERE lid='$lid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$dl = $row[title];
$newpagetitle = "Nome del tuo Sito :: $dl";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Web Links
if($name=="Web_Links"){
global $l_op,$cid,$lid;
$name=ereg_replace("_", " ", "$name");
$newpagetitle = "Nome del tuo Sito :: $name";
$newpagetitle = check_html($newpagetitle, nohtml);
if($l_op=="viewlink") {
$sql = "SELECT title, parentid FROM ".$prefix."_links_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$parent = $row[parentid];
if($parent=="0"){
$newpagetitle = "Nome del tuo Sito :: $cat";
$newpagetitle = check_html($newpagetitle, nohtml);
}
else{
$sql = "SELECT title FROM ".$prefix."_links_categories WHERE cid='$parent'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$parent = $row[title];
$newpagetitle = "Nome del tuo Sito :: $parent $item_delim $cat";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
}
// Content
if($name=="Content"){
global $pa,$cid,$pid;
$newpagetitle = "Nome del tuo Sito :: $name";
$newpagetitle = check_html($newpagetitle, nohtml);
if($pa=="list_pages_categories") {
$sql = "SELECT title FROM ".$prefix."_pages_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$newpagetitle = "Nome del tuo Sito :: $cat";
$newpagetitle = check_html($newpagetitle, nohtml);
}
if($pa=="showpage") {
$sql = "SELECT title, cid FROM ".$prefix."_pages WHERE pid='$pid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$page = $row[title];
$cid = $row[cid];
$sql = "SELECT title FROM ".$prefix."_pages_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$newpagetitle = "Nome del tuo Sito :: $cat $item_delim $page";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Reviews
if($name=="Reviews"){
global $rop,$id;
$newpagetitle = "Nome del tuo Sito :: $name";
if($rop=="showcontent") {
$sql = "SELECT title FROM ".$prefix."_reviews WHERE id='$id'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$rev = $row[title];
$newpagetitle = "Nome del tuo Sito :: $rev";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Stories Archive
if($name=="Stories_Archive"){
global $sa,$year,$month_l;
$name=ereg_replace("_", " ", "$name");
$newpagetitle = "Nome del tuo Sito :: $name";
if($sa=="show_month") {
$newpagetitle = "$month_l, $year";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Sections
if($name=="Sections"){
global $op,$secid,$artid;
$newpagetitle = "Nome del tuo Sito :: $name";
$newpagetitle = check_html($newpagetitle, nohtml);
if($op=="listarticles") {
$sql = "SELECT secname FROM ".$prefix."_sections WHERE secid='$secid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sec = $row[secname];
$newpagetitle = "Nome del tuo Sito :: $sec";
$newpagetitle = check_html($newpagetitle, nohtml);
}
if($op=="viewarticle") {
$sql = "SELECT title, secid FROM ".$prefix."_seccont WHERE artid='$artid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$art = $row[title];
$cid = $row[secid];
$sql = "SELECT secname FROM ".$prefix."_sections WHERE secid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sec = $row[secname];
$newpagetitle = "$Nome del tuo Sito :: sec $item_delim $art";
$newpagetitle = check_html($newpagetitle, nohtml);
}
}
// Catchall for anything we don't have custom coding for
if($newpagetitle==""){
$name=ereg_replace("_", " ", "$name");
$newpagetitle="Nome del tuo Sito $item_delim $name";
$newpagetitle = check_html($newpagetitle, nohtml);
}
// Admin Pages
if(substr($_SERVER['REQUEST_URI'], 0, 10)=="/admin.php"){
$newpagetitle="Nome del tuo Sito :: $item_delim Administration";
$newpagetitle = check_html($newpagetitle, nohtml);
}
// If we're on the main page let's use our site slogan
if($_SERVER['REQUEST_URI']=="/index.php" || $_SERVER['REQUEST_URI']=="/"){
$newpagetitle="$slogan";
$newpagetitle = check_html($newpagetitle, nohtml);
}
// We're Done! Place the Title on the page
echo "<title>$newpagetitle</title>\n";
?>
in meta.php aggiungi questo codice:
// ---> This generates the desc for module----> Content
// Content
if($name=="Content"){
global $pa,$cid,$pid;
$MyNewdesc = "Nome del tuo Sito :: $name";
$MyNewdesc = check_html($MyNewdesc , nohtml);
if($pa=="list_pages_categories") {
$sql = "SELECT title FROM ".$prefix."_pages_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$MyNewdesc = "Nome del tuo Sito :: $cat";
$MyNewdesc = check_html($MyNewdesc , nohtml);
}
if($pa=="showpage") {
$sql = "SELECT title, cid FROM ".$prefix."_pages WHERE pid='$pid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$page = $row[title];
$cid = $row[cid];
$sql = "SELECT title FROM ".$prefix."_pages_categories WHERE cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$cat = $row[title];
$MyNewdesc = "Nome del tuo Sito :: $cat $item_delim $page";
$MyNewdesc = check_html($MyNewdesc , nohtml);
}
}
Ovviamente il file header.php nella root (dove sta il file config.php x intenderci) non deve più contenere le <title></title> tag.
al loro posto devi inserire:
include("includes/dynamic_titles.php");
include("includes/meta.php");
Spero di esserti stato utile.
Cordialmente