1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

forum SEO - auto meta description

This commit is contained in:
secretr
2011-06-28 12:58:26 +00:00
parent 501234260f
commit e6e74150d3
2 changed files with 20 additions and 1 deletions

View File

@@ -84,6 +84,16 @@ $forumInfo['forum_description'] = $e107->tp->toHTML($forumInfo['forum_descriptio
$_forum_name = (substr($forumInfo['forum_name'], 0, 1) == '*' ? substr($forumInfo['forum_name'], 1) : $forumInfo['forum_name']); $_forum_name = (substr($forumInfo['forum_name'], 0, 1) == '*' ? substr($forumInfo['forum_name'], 1) : $forumInfo['forum_name']);
define('e_PAGETITLE', $_forum_name.' / '.LAN_01); define('e_PAGETITLE', $_forum_name.' / '.LAN_01);
// SEO - meta description (auto)
if(!empty($forumInfo['forum_description']))
{
define("META_DESCRIPTION", $tp->text_truncate(
str_replace(
array('"', "'"), '', strip_tags($tp->toHTML($forumInfo['forum_description']))
), 250, '...'));
}
//define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators'])); //define('MODERATOR', $forum_info['forum_moderators'] != '' && check_class($forum_info['forum_moderators']));
//$modArray = $forum->forum_getmods($forum_info['forum_moderators']); //$modArray = $forum->forum_getmods($forum_info['forum_moderators']);

View File

@@ -89,7 +89,7 @@ if (USER && (USERID != $thread->threadInfo['thread_user'] || $thread->threadInfo
$forum->threadIncview($thread->threadInfo['thread_id']); $forum->threadIncview($thread->threadInfo['thread_id']);
} }
define('e_PAGETITLE', $tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off').' / '.$e107->tp->toHTML($thread->threadInfo['forum_name'], true, 'no_hook, emotes_off').' / '.LAN_01); define('e_PAGETITLE', strip_tags($tp->toHTML($thread->threadInfo['thread_name'], true, 'no_hook, emotes_off')).' / '.$e107->tp->toHTML($thread->threadInfo['forum_name'], true, 'no_hook, emotes_off').' / '.LAN_01);
$forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']); $forum->modArray = $forum->forumGetMods($thread->threadInfo['forum_moderators']);
define('MODERATOR', (USER && $forum->isModerator(USERID))); define('MODERATOR', (USER && $forum->isModerator(USERID)));
@@ -108,6 +108,15 @@ if (MODERATOR && isset($_POST['mod']))
$num = $thread->page ? $thread->page - 1 : 0; $num = $thread->page ? $thread->page - 1 : 0;
$postList = $forum->PostGet($thread->threadId, $num * $thread->perPage, $thread->perPage); $postList = $forum->PostGet($thread->threadId, $num * $thread->perPage, $thread->perPage);
// SEO - meta description (auto)
if(count($postList))
{
define("META_DESCRIPTION", $tp->text_truncate(
str_replace(
array('"', "'"), '', strip_tags($tp->toHTML($postList[0]['post_entry']))
), 250, '...'));
}
$gen = new convert; $gen = new convert;
if ($thread->message) if ($thread->message)
{ {