| |
|
| :: |
| Author |
Message |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Tue Oct 17, 2006 5:11 pm Post subject: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
EZ Content MOD
http://www.phpbb.com/phpBB/viewtopic.php?t=395370
| Code: |
<?php
/***************************************************************************
* content.php
* -------------------
* begin : Feb, 2006
* e-mail : chris@laxforums.co.uk
*
*
***************************************************************************/
/***************************************************************************
*
* 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, or
* (at your option) any later version.
*
***************************************************************************/
/***************************************************************************
*
* For this script to work apropriately you must change the config values
* Bellow. All configuration options are between this block and the next
*
****************************************************************************/
//Define which forum content is allowed from, replace 40, with your forum id
$forum_permission = '40';
/***************************************************************************
*
* End of Configuration
*
****************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_CONTENT);
init_userprefs($userdata);
//
// End session management
//
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
$mode = htmlspecialchars($mode);
}
else
{
$mode = "";
}
switch( $mode )
{
case "view":
$get_topic = ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) ? intval($HTTP_GET_VARS[POST_TOPIC_URL]) : intval($HTTP_POST_VARS[POST_TOPIC_URL]);
//
// get request topic from database
//
$sql = "SELECT * FROM " . TOPICS_TABLE . " WHERE topic_id = $get_topic";
if (!($result= $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['data_error'], '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
//
// topic info
//
$topic_id = $row['topic_id'];
$topic_title = $row['topic_title'];
$topic_poster = $row['topic_poster'];
$topic_time = $row['topic_time'];
$date = create_date($board_config['default_dateformat'], $row['topic_time'], $board_config['board_timezone']);
$topic_views = $row['topic_views'];
$topic_replies = $row['topic_replies'];
$topic_first_post_id = $row['topic_first_post_id'];
$get_forum = $row['forum_id'];
//
//verify the topic has permission
//
if ($forum_permission != $get_forum)
{
message_die(GENERAL_ERROR, $lang['permission_error']);
}
//
// get post text
//
$sql = "SELECT post_text, bbcode_uid FROM " . POSTS_TEXT_TABLE . " WHERE post_id = $topic_first_post_id";
if (!($result= $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['data_error'], '', __LINE__, __FILE__, $sql);
}
$row1 = $db->sql_fetchrow($result);
$post = $row1['post_text'];
$bbcode_uid = $row1['bbcode_uid'];
$post = smilies_pass($post);
$post = ($board_config['allow_bbcode']) ? bbencode_second_pass($post, $bbcode_uid) : preg_replace("/\:$bbcode_uid/si", '', $post);
$post = make_clickable($post);
$post = str_replace("\n", "\n<br />\n", $post);
//
// get topic starter's name
//
$sql = "SELECT username FROM " . USERS_TABLE . " WHERE user_id = $topic_poster";
if (!($result= $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['data_error'], '', __LINE__, __FILE__, $sql);
}
$row2 = $db->sql_fetchrow($result);
$user_name = $row2['username'];
$template->assign_vars(array(
'TITLE' => $topic_title,
'USER' => $user_name,
'DATE' => $date,
'POST' => $post,
'VIEWS' => $topic_views,
'REPLIES' => $topic_replies,
'POSTED_BY' => $lang['News_Posted_By'],
'NEWS_VIEWS' => $lang['News_Views'],
'AND' => $lang['And'],
'NEWS_REPLIES' => $lang['News_Replies'],
'POST_REPLY' => $lang['News_Post'],
'U_TITLE_CLICK' => append_sid('viewtopic.'.$phpEx.'?'.POST_TOPIC_URL.'='.$topic_id),
'U_USER_CLICK' => append_sid('profile.'.$phpEx.'?mode=viewprofile&'.POST_USERS_URL.'='.$topic_poster),
'U_REPLY_CLICK' => append_sid('posting.'.$phpEx.'?mode=reply&'.POST_TOPIC_URL.'='.$topic_id))
);
$page_title = $topic_title;
$template->set_filenames(array(
'body' => 'content_body.tpl')
);
include($phpbb_root_path .'includes/page_header.'. $phpEx);
$template->pparse('body');
include($phpbb_root_path .'includes/page_tail.'. $phpEx);
break;
default:
$sql = "SELECT * FROM " . TOPICS_TABLE . " WHERE forum_id = $forum_permission";
if (!($result= $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, $lang['data_error'], '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$template->assign_block_vars('pages', array(
'PAGENAME' => $row['topic_title'],
'PAGEURL' => append_sid('content.'.$phpEx.'?mode=view&'.POST_TOPIC_URL.'='.$row['topic_id']))
);
}
$page_title = $lang['EZcontent'];
$template->set_filenames(array(
'body' => 'content_pages_body.tpl')
);
include($phpbb_root_path .'includes/page_header.'. $phpEx);
$template->pparse('body');
include($phpbb_root_path .'includes/page_tail.'. $phpEx);
break;
}
?> |
|
Last edited by Peter77 on Sun Mar 04, 2007 9:31 am; edited 5 times in total |
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
Posted: Wed Oct 18, 2006 7:46 am Post subject: Re: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
Open :
Find :
| Code: | else
{
$mode = "";
} |
After add :
| Code: | // www.phpBB-SEO.com SEO TOOLKIT BEGIN - Restore Censoring
// Define censored word matches
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
// www.phpBB-SEO.com SEO TOOLKIT END |
Find :
| Code: | | $topic_title = $row['topic_title']; |
Replace with :
| Code: | // www.phpBB-SEO.com SEO TOOLKIT BEGIN - Restore Censoring
$topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, $row['topic_title']) : $row['topic_title'];
$seo_topic_name = $topic_title;
// www.phpBB-SEO.com SEO TOOLKIT END |
Find :
| Code: | | $template->assign_block_vars('pages', array( |
Before add :
| Code: | // www.phpBB-SEO.com SEO TOOLKIT BEGIN - Restore Censoring
$topic_title = (count($orig_word)) ? preg_replace($orig_word, $replacement_word, $row['topic_title']) : $row['topic_title'];
// www.phpBB-SEO.com SEO TOOLKIT END |
Find :
| Code: | 'PAGEURL' => append_sid('content.'.$phpEx.'?mode=view&'.POST_TOPIC_URL.'='.$row['topic_id']))
|
Replace with :
| Code: | //'PAGEURL' => append_sid('content.'.$phpEx.'?mode=view&'.POST_TOPIC_URL.'='.$row['topic_id']))
'PAGEURL' => append_sid(format_url($topic_title) . '-ct' . $row['topic_id'] . '.html')) |
I do it like this here because there is only one link, so it's faster
Open :
find :
| Code: | # END PHPBB PAGES
##################################################### |
After add :
| Code: | # EZcontent
RewriteRule ^phpbb/.+-ct([0-9]+)\.html$ /phpbb/content.php?mode=view&t=$1 [QSA,L] |
Don't forget to take car about paths in the rewriterule (phpbb/).
You URLs will be of the kind : topic-title-ctxx.html
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Last edited by dcz on Fri Oct 20, 2006 7:46 am; edited 1 time in total |
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Thu Oct 19, 2006 3:38 am Post subject: Re: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
| Hello, dcz... thank you for taking the time to work with this MOD. Seems like I have an small bug here. The URL's are SEOed but will not open the page. |
Last edited by Peter77 on Fri Oct 20, 2006 3:32 pm; edited 1 time in total |
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Thu Oct 19, 2006 4:36 pm Post subject: Re: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
| Yup, I have double checked and re checked agian before posting this. here is the content.php file. juarol.com/content.txt |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Fri Oct 20, 2006 3:36 pm Post subject: Re: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
| dcz wrote: | Lol, I think it's just the rewriterule, should be :
| Code: |
# EZcontent
RewriteRule ^phpbb/.+-ct([0-9]+)\.html$ /phpbb/content.php?mode=view&t=$1 [QSA,L] |
I edit my post
++ |
Thank you, dcz ... that works great!  |
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Sat Mar 03, 2007 2:36 pm Post subject: Re: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
[ Requesting for 0.2.2. ] edited first post for quick view of content.php  |
_________________ Juarol.com
| Frekuenciadigital.com | |
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 14279
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Mon Aug 20, 2007 5:36 am Post subject: Re: [ Patch ] EZ Content SEO'd for Advanced mod rewrite 0.2.2 |
|
|
Just a quick note update on this Patch.
If you would like to rename content.php to content.html or whatever-you-want.html
Open .htaccess
FIND:
| Code: |
# EZcontent
RewriteRule ^phpbb/.+-ct([0-9]+)\.html$ /phpbb/content.php?mode=view&t=$1 [QSA,L]
|
AFTER ADD:
| Code: |
RewriteRule ^phpbb/content\.html$ /phpbb/content.php [QSA,L,NC] |
 |
|
|
| Back to top |
|
 |
|
|
| Navigation |
Similar Topics |
|
|
|
|
|
|
|