Метатеги для новостей для PHP-Fusion

Метатеги для новостей для PHP-Fusion


Модификация для новостей в плане СЕО. Добавляет Метатег title, Описание для новости, Ключевые слова.

Установка.

Открыть файл news.php

Найти

add_to_title($locale['global_201'].$news_subject);


Заменить на

if($data['news_metatitle'] != "") { set_title($data['news_metatitle']); } else { add_to_title($locale['global_201'].$news_subject); }
if($data['news_descr'] != "") { set_meta("description", $content=$data['news_descr']); }
if($data['news_keywords'] != "") { set_meta("keywords", $content=$data['news_keywords']); }


Открыть файл administration/news.php

Найти

$news_start_date = 0; $news_end_date = 0;


Выше добавить

$news_metatitle = stripinput($_POST['news_metatitle']);
$news_descr = stripinput($_POST['news_descr']);
$news_keywords = stripinput($_POST['news_keywords']);


Найти

$result = dbquery("UPDATE ".DB_NEWS." SET news_subject='$news_subject', news_cat='$news_cat', news_end='$news_end_date', news_image='$news_image', news_news='$body', news_extended='$body2', news_breaks='$news_breaks',".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "")." news_start='$news_start_date', news_image_t1='$news_image_t1', news_image_t2='$news_image_t2', news_visibility='$news_visibility', news_draft='$news_draft', news_sticky='$news_sticky', news_allow_comments='$news_comments', news_allow_ratings='$news_ratings' WHERE news_id='".$_POST['news_id']."'");


Заменить на

$result = dbquery("UPDATE ".DB_NEWS." SET news_subject='$news_subject', news_cat='$news_cat', news_end='$news_end_date', news_image='$news_image', news_news='$body', news_extended='$body2', news_metatitle='$news_metatitle', news_descr='$news_descr', news_keywords='$news_keywords', news_breaks='$news_breaks',".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "")." news_start='$news_start_date', news_image_t1='$news_image_t1', news_image_t2='$news_image_t2', news_visibility='$news_visibility', news_draft='$news_draft', news_sticky='$news_sticky', news_allow_comments='$news_comments', news_allow_ratings='$news_ratings' WHERE news_id='".$_POST['news_id']."'");


Найти

$result = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_cat, news_news, news_extended, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_cat', '$body', '$body2', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_image', '$news_image_t1', '$news_image_t2', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");


Заменить на

$result = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_cat, news_news, news_extended, news_metatitle, news_descr, news_keywords, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_cat', '$body', '$body2', '$news_metatitle', '$news_descr', '$news_keywords', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_image', '$news_image_t1', '$news_image_t2', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");


Найти

} else {
    $news_breaks = "";
}


Наже добавить

$news_metatitle = stripinput($_POST['news_metatitle']);
$news_descr = stripinput($_POST['news_descr']);
$news_keywords = stripinput($_POST['news_keywords']);


Найти

$result = dbquery("SELECT news_subject, news_cat, news_news, news_extended, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_breaks, news_allow_comments, news_allow_ratings FROM ".DB_NEWS." WHERE news_id='".(isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'])."' LIMIT 1");


Заменить на

$result = dbquery("SELECT news_subject, news_cat, news_news, news_extended, news_metatitle, news_descr, news_keywords, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_breaks, news_allow_comments, news_allow_ratings FROM ".DB_NEWS." WHERE news_id='".(isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'])."' LIMIT 1");


Найти

$body2 = phpentities(stripslashes($data['news_extended']));


Ниже добавить

$news_metatitle = $data['news_metatitle'];
$news_descr = $data['news_descr'];
$news_keywords = $data['news_keywords'];


Найти

$body2 = "";


Ниже добавить

$news_metatitle = "";
$news_descr = "";
$news_keywords = "";


Найти

echo "<td class='tbl'>".$locale['430']."</td>\n";


Выше добавить

echo "<td valign='top' width='100' class='tbl'>Метатег title:</td>\n";
echo "<td class='tbl'><input type='text' name='news_metatitle' value='".$news_metatitle."' class='textbox' style='width:388px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td valign='top' width='100' class='tbl'>Описание для новостии</td>\n";
echo "<td class='tbl'><input type='text' name='news_descr' value='".$news_descr."' class='textbox' style='width:388px;' /> <span class='small2'>(не более 200 символов)</span></td>\n";
echo "</tr>\n<tr>\n";
echo "<td valign='top' width='100' class='tbl'>Ключевые слова</td>\n";
echo "<td class='tbl'><textarea name='news_keywords' class='textbox' style='width:388px;height:70px;'>".$news_keywords."</textarea></td>\n";
echo "</tr>\n<tr>\n";


В архиве файл установки, и модифицированные файлы для PF 7.02.06.



Просмотров: 1610
20.06.2015, 18:53 -

Категория: Web-скрипты » PHP-Fusion