SEO MOD

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: Pagnation Problem

Post by rwap01 »

BlooLagoo wrote:I've checked out most things in this thread, but couldn't find a solution to this problem.

Image
The last page link doesn't work, it instead links the page after the previous page.

Eg: In that picture 55 takes me to page 6 (the next page to be shown on the list). No matter what I can't jump to the last page in topics that way.

Is anyone else having that trouble/stumbled upon a solution. If I've been unclear, I'll try and explain it better.

I'm not actually sure where to look at the moment.
Have a look at my essential fixes post which includes a link to all of the fixes I can find for this MOD which need to be implemented.
This has been resolved - actual fix is http://www.phpbb.com/community/viewtopi ... 5#p5274095
BlooLagoo
Registered User
Posts: 13
Joined: Sun Sep 30, 2007 11:00 pm

Re: SEO MOD

Post by BlooLagoo »

Thank you. I went and accidentally skipped that one (I'd been through the whole list ;)), then my blasted FTP program was having wonderful issues updating the file.

Got it working now.
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: SEO MOD

Post by rwap01 »

NLCrEaTiVe wrote:Unfortunately I'm experiencing another problem. When I create a topic with, for example, :P, and click on it I am redirected to the forum index. It does not happen with a topic without the ':'.

I have applied the following fix already:

Code: Select all

    function clean_url($url)
    {
       $url = trim(str_replace(array('Re:', 're:'), '', $url));
       //$find = array('?', '#', '%', '?', '^', '.', '/', ' ', '_', ')', '(', '[', ']', ':', '.');
       $find = array(' ', '@', '=', '$', '&amp', '+', '~', '`', '?', '#', '%', '!', '^', '.', '/', '_', ')', '(', '[', ']', '{', '}', ':', ',', '<', '>', ';', '|', '*', '"', '\'', '\\');
       $url = str_replace($find, '-', censor_text($url));
       // remove all duplicates "-"
       $url = ereg_replace("-+", '-', $url);
       // remove the last "-", to avoid this "/test--t14.html"
       if ($url{strlen($url)-1} == '-')
       {
          $url = substr($url, 0, -1);
       }
       return utf8_clean_string($url);
    }

I cannot see this problem on my forum for some reason - for example:
http://www.rwapservices.co.uk/ZX80_ZX81 ... &t=68#p448

Can you provide a link to the topic on your forum which is causing this problem?
NLCrEaTiVe
Registered User
Posts: 29
Joined: Wed Apr 04, 2007 2:39 pm

Re: SEO MOD

Post by NLCrEaTiVe »

That's not possible at this moment, but here is my functions_seo.php file:

Code: Select all

<?php
/**
*
* @package phpBB3
* @version $Id: functions_seo.php 58 2007-11-09 02:21:30Z Handyman $
* @copyright (c) 2007 StarTrekGuide Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
 * @ignore
 */

if (!defined('IN_PHPBB'))
{
	exit;
}

function format_url($name, $id, $start = 0, $xtra_params = false, $append = true)
{
	global $phpbb_root_path, $config;

	$name = clean_url($name);

	$ext = '.html';
	if (isset($config['seo_ext']))
	{
		$ext = '.' . $config['seo_ext'];
	}

	switch (substr($id, 0, 1))
	{
		case 'p':
			if ($append)
			{
				return append_seo_sid($phpbb_root_path . $name . '-' . $id . (($start) ? "s$start" : '') . $ext, $xtra_params) . '#' . $id;
			}
		break;
		case 't':
		case 'f':
			if ($append)
			{
				return append_seo_sid($phpbb_root_path . $name . '-' . $id . (($start) ? "s$start" : '') . $ext, $xtra_params);
			}
		break;
	}
	return $phpbb_root_path . $name . '-' . $id;
}

function clean_url($url)
{
   $url = trim(str_replace(array('Re:', 're:'), '', $url));
   //$find = array('?', '#', '%', '?', '^', '.', '/', ' ', '_', ')', '(', '[', ']', ':', '.');
   $find = array(' ', '@', '=', '$', '&amp', '+', '~', '`', '?', '#', '%', '!', '^', '.', '/', '_', ')', '(', '[', ']', '{', '}', ':', ',', '<', '>', ';', '|', '*', '"', '\'', '\\');
   $url = str_replace($find, '-', censor_text($url));
   // remove all duplicates "-"
   $url = ereg_replace("-+", '-', $url);
   // remove the last "-", to avoid this "/test--t14.html"
   if ($url{strlen($url)-1} == '-')
   {
      $url = substr($url, 0, -1);
   }
   return utf8_clean_string($url);
}

function append_seo_sid($url, $params = false, $is_amp = true, $session_id = false)
{
	global $_SID, $_EXTRA_URL, $config;

	$append = '.html';
	if (isset($config['seo_ext']))
	{
		$append = '.' . $config['seo_ext'];
	}

	// Assign sid if session id is not specified
	if ($session_id === false)
	{
		$session_id = $_SID;
	}

	$amp_delim = ($is_amp) ? '&' : '&';
	$url_delim = (strpos($url, $append . '-') === false) ? '-' : $amp_delim;

	// Appending custom url parameter?
	$append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : '';

	// Use the short variant if possible ;)
	if ($params === false)
	{
		// Append session id
		if (!$session_id)
		{
			return $url;
		}
		else
		{
			return $url . $url_delim . 'sid=' . $session_id;
		}
	}

	// Build string if parameters are specified as array
	if (is_array($params))
	{
		$output = array();

		foreach ($params as $key => $item)
		{
			if ($item === NULL)
			{
				continue;
			}

			$output[] = $key . '=' . $item;
		}

		$params = implode($amp_delim, $output);
	}

	// Append session id and parameters (even if they are empty)
	// If parameters are empty, the developer can still append his/her parameters without caring about the delimiter
	return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . $params . ((!$session_id) ? '' : $amp_delim . 'sid=' . $session_id);
}

function moved_forum($id, $start = 0)
{
	global $phpbb_root_path, $phpEx, $db;

	$path = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
	if (substr($path, 1, 10 + strlen($phpEx)) == 'viewforum.' . $phpEx)
	{
		$sql = 'SELECT forum_name
			FROM ' . FORUMS_TABLE . "
			WHERE forum_id = $id";

		$result = $db->sql_query($sql);
		$forum_name = clean_url($db->sql_fetchfield('forum_name'));
		$db->sql_freeresult($result);

		header('HTTP/1.1 301 Moved Permanently');
		header('Location: ' . format_url($forum_name, "f$id", $start));
		exit();
	}
	return;
}

function moved_topic($id, $type, $start = 0)
{
	global $phpbb_root_path, $phpEx, $db;

	$path = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
	if (substr($path, 1, 10 + strlen($phpEx)) == 'viewtopic.' . $phpEx)
	{
		if ($type == 'topic')
		{
			$sql = 'SELECT topic_title
				FROM ' . TOPICS_TABLE . "
				WHERE topic_id = $id";
			$newid = "t$id";
		}
		else
		{
			$sql = 'SELECT t.topic_title
				FROM ' . POSTS_TABLE . ' p
					' . TOPICS_TABLE . " t
				WHERE t.topic_id = p.topic_id
					AND t.topic_id = $id";
			$newid = "p$id";
		}
		$result = $db->sql_query($sql);
		$topic_title = clean_url($db->sql_fetchfield('topic_title'));
		$db->sql_freeresult($result);

		header('HTTP/1.1 301 Moved Permanently');
		header('Location: ' . format_url($topic_title, $newid, $start));
		exit();
	}
	return;
}

function generate_seo_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '')
{
	global $template, $user, $config, $phpEx;

	$append = '.html';
	if (isset($config['seo_ext']))
	{
		$append = '.' . $config['seo_ext'];
	}

	// Make sure $per_page is a valid value
	$per_page = ($per_page <= 0) ? 1 : $per_page;

	$seperator = '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>';
	$total_pages = ceil($num_items / $per_page);

	if ($total_pages == 1 || !$num_items)
	{
		return false;
	}

	$on_page = floor($start_item / $per_page) + 1;

	$page_string = ($on_page == 1) ? '<strong>1</strong>' : '<a href="' . append_seo_sid($base_url . $append) . '">1</a>';

	if ($total_pages > 5)
	{
		$start_cnt = min(max(1, $on_page - 4), $total_pages - 5);
		$end_cnt = max(min($total_pages, $on_page + 4), 6);

		$page_string .= ($start_cnt > 1) ? ' ... ' : $seperator;

		for ($i = $start_cnt + 1; $i < $end_cnt; $i++)
		{
			$page_string .= ($i == $on_page) ? '<strong>' . $i . '</strong>' : '<a href="' . append_seo_sid($base_url . 's' . (($i - 1) * $per_page) . $append)  . '">' . $i . '</a>';
			if ($i < $end_cnt - 1)
			{
				$page_string .= $seperator;
			}
		}

		$page_string .= ($end_cnt < $total_pages) ? ' ... ' : $seperator;
	}
	else
	{
		$page_string .= $seperator;

		for ($i = 2; $i < $total_pages; $i++)
		{
			$page_string .= ($i == $on_page) ? '<strong>' . $i . '</strong>' : '<a href="' . append_seo_sid($base_url . 's' . (($i - 1) * $per_page) . $append) . '">' . $i . '</a>';
			if ($i < $total_pages)
			{
				$page_string .= $seperator;
			}
		}
	}

	$page_string .= ($on_page == $total_pages) ? '<strong>' . $total_pages . '</strong>' : '<a href="' . append_seo_sid($base_url . 's' . (($total_pages - 1) * $per_page) . $append) . '">' . $total_pages . '</a>';

	if ($add_prevnext_text)
	{
		if ($on_page != 1)
		{
			$page_string = '<a href="' . append_seo_sid($base_url . 's' . (($on_page - 2) * $per_page) . $append) . '">' . $user->lang['PREVIOUS'] . '</a>&nbsp;&nbsp;' . $page_string;
		}

		if ($on_page != $total_pages)
		{
			$page_string .= '&nbsp;&nbsp;<a href="' . append_seo_sid($base_url . 's' . ($on_page * $per_page) . $append) . '">' . $user->lang['NEXT'] . '</a>';
		}
	}

	$template->assign_vars(array(
		$tpl_prefix . 'BASE_URL'	=> $base_url,
		$tpl_prefix . 'PER_PAGE'	=> $per_page,

		$tpl_prefix . 'PREVIOUS_PAGE'	=> ($on_page == 1) ? '' : append_seo_sid($base_url . 's' . (($on_page - 2) * $per_page) . $append),
		$tpl_prefix . 'NEXT_PAGE'		=> ($on_page == $total_pages) ? '' : append_seo_sid($base_url . 's' . ($on_page * $per_page) . $append),
		$tpl_prefix . 'TOTAL_PAGES'		=> $total_pages)
	);

	return $page_string;
}

    function seo_footer()
    {
        global $template, $user;

        global $phpbb_root_path, $phpEx;

        $path = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');

        if (substr($path, 1, 5) . ".$phpEx" === "index.$phpEx")
        {
            $autocom = request_var('autocom', '');
            $act = request_var('act', '');
            $do = request_var('do','');
            
            if (!($act == 'Arcade' && $do == 'newscore') && !($autocom == 'arcade'))
            {        
                header('HTTP/1.1 301 Moved Permanently');
                header('Location: ' . append_sid($phpbb_root_path));
                exit();
            }
        }

        $string = '<br />' . base64_decode('U0VPIE1PRCAmY29weTsgMjAwNyA8YSBocmVmPSJodHRwOi8vc3RhcnRyZWtndWlkZS5jb20iPlN0YXJUcmVrR3VpZGU8L2E+');
        $template->assign_var('DEBUG_OUTPUT', (isset($template->_tpldata['.'][0]['DEBUG_OUTPUT'])) ? $template->_tpldata['.'][0]['DEBUG_OUTPUT'] . $string : $string);

        return;
    }  

function topic_generate_seo_pagination($replies, $url)
{
   global $config, $user, $phpEx;

   $append = '.html';
   if (isset($config['seo_ext']))
   {
      $append = '.' . $config['seo_ext'];
   }
	// Make sure $per_page is a valid value
	$per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page'];

	if (($replies + 1) > $per_page)
	{
		$total_pages = ceil(($replies + 1) / $per_page);
		$pagination = '';

		$times = 1;
		for ($j = 0; $j < $replies + 1; $j += $per_page)
		{
			$pagination .= '<a href="' . append_seo_sid($url . 's' . $j . $append) . '">' . $times . '</a>';
			if ($times == 1 && $total_pages > 5)
			{
				$pagination .= ' ... ';

				// Display the last three pages
				$times = $total_pages - 3;
				$j += ($total_pages - 4) * $per_page;
			}
			else if ($times < $total_pages)
			{
				$pagination .= '<span class="page-sep">' . $user->lang['COMMA_SEPARATOR'] . '</span>';
			}
			$times++;
		}
	}
	else
	{
		$pagination = '';
	}

	return $pagination;
}
?>
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: SEO MOD

Post by rwap01 »

It is unlikely to be the functions_seo.php file unfortunately, but something calling the format_url () function
NLCrEaTiVe
Registered User
Posts: 29
Joined: Wed Apr 04, 2007 2:39 pm

Re: SEO MOD

Post by NLCrEaTiVe »

Ok. in which file could the problem occur? Whenever I open a topic with a special character (like ':') it directs me to the forum index, while links without such characters work fine.
terryrw
Registered User
Posts: 42
Joined: Mon Dec 10, 2007 12:05 am

Re: SEO MOD

Post by terryrw »

terryrw wrote:
rwap01 wrote:
terryrw wrote:I am having issues with the mod. Let's say for example a user is browing a category and found a subject that has 5 pages. 1,2,3,4,5,6. If they click they try go directly to a specific page number "example, they click on page 5" they get a 404 page error like this. (The requested URL /forum/fishing-contest-for-the-kid%CA%B9s--t1577s30.php does not exist.) I can't figure out what is causing this. If they open the subject and click next to go through all 6 pages there is no problems. It is only when they try to click a page from the topics pages. I attempted to re-edit all the files 4 times and have the same result. Can someone please offer me some assistance, as I am not a coder.
This is one of the pagination bugs referred to in my SEO Essential fixes post
Well, I made all of the edits you listed but I am still having the same exact problem as before. When I click on a page number that is supposed to jump to that page I get the same errors as before adding the edits.

Bumping this, I haven't received a reply to help me. I really would like to use this mod but this one problem is putting the entire modification to a stop. The above quoted text explains my issue and what I have done to try and resolve the issue.

404 Not Found
The requested URL /forum/lighthouse-deer-hunt%CA%B9s-illinois-t947s30.php does not exist.

Any suggestions on why I am having these problems even after applying the fixes mentioned in the thread? I am going to revert back to my original non modded files for now. Hope somone can help me out.

bumping for help
Darkness568
Registered User
Posts: 55
Joined: Sun Apr 13, 2008 11:24 pm
Contact:

Re: SEO MOD

Post by Darkness568 »

Ummm, for some reason my forum whenever i click on a link i get a 404 error granted there are no posts in the section, but somehow i still get a error can you tell me how to fix that please.
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: SEO MOD

Post by rwap01 »

NLCrEaTiVe wrote:Ok. in which file could the problem occur? Whenever I open a topic with a special character (like ':') it directs me to the forum index, while links without such characters work fine.
Not really sure - I guess it will be an issue with either viewforum.php or view topic.php - compare all the mods in the MODx - you may have inadvertantly left some text in when altering lines.
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: SEO MOD

Post by rwap01 »

Darkness568 wrote:Ummm, for some reason my forum whenever i click on a link i get a 404 error granted there are no posts in the section, but somehow i still get a error can you tell me how to fix that please.
OK so you get a 404 error - what page is the link trying to open - I bet, like the issue above, it is trying to open www.yourforum.com/forums/viewtopic-title-t19.php rather than www.yourforum.com/forums/viewtopic-title-t19.html.

Ensure that changing the "php" extension to "html" works and that will help you track down the error in either viewforum.php or viewtopic.php - look at the references to format_url() and see how they should be set out as per the MODx

As I read more and more of these error reports - quite a lot are not actual bugs in the SEO MOD, but actually errors when implementing it.

I think all of the bugs in the actual MOD have now been resolved.
terryrw
Registered User
Posts: 42
Joined: Mon Dec 10, 2007 12:05 am

Re: SEO MOD

Post by terryrw »

rwap01 wrote:
Darkness568 wrote:Ummm, for some reason my forum whenever i click on a link i get a 404 error granted there are no posts in the section, but somehow i still get a error can you tell me how to fix that please.
OK so you get a 404 error - what page is the link trying to open - I bet, like the issue above, it is trying to open http://www.yourforum.com/forums/viewtopic-title-t19.php rather than http://www.yourforum.com/forums/viewtop ... e-t19.html.

Ensure that changing the "php" extension to "html" works and that will help you track down the error in either viewforum.php or viewtopic.php - look at the references to format_url() and see how they should be set out as per the MODx

As I read more and more of these error reports - quite a lot are not actual bugs in the SEO MOD, but actually errors when implementing it.

I think all of the bugs in the actual MOD have now been resolved.
rwap01,

Can you take a look at my post, I'm having a similar issue and performed the edits you stated and still getting the error. The link is taking me to a .php page and not .html. This is starting to get to me. Thanks
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: SEO MOD

Post by rwap01 »

terryrw wrote: rwap01,

Can you take a look at my post, I'm having a similar issue and performed the edits you stated and still getting the error. The link is taking me to a .php page and not .html. This is starting to get to me. Thanks
I think that you will have missed out changing one of the changes in either viewforum.php or viewtopic.php where it calls up

'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&$u_sort_param"), $topics_count, $config['topics_per_page'], $start),
or
'PAGINATION' => topic_generate_pagination($replies, $view_topic_url),
or
$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start);

See MODx for what these should be.
Darkness568
Registered User
Posts: 55
Joined: Sun Apr 13, 2008 11:24 pm
Contact:

Re: SEO MOD

Post by Darkness568 »

What do you mean when you refer to MODx. The actual file of the mod or the program MODx? Also with the extension changes do i have to change the extensions on the files themselves in order for the extensions to be loaded if so what is the reasoning in changing the extensions. I will try and do the changes and report back if i still get a error.
rwap01
Registered User
Posts: 91
Joined: Wed Jun 04, 2008 11:09 am
Contact:

Re: SEO MOD

Post by rwap01 »

Darkness568 wrote:What do you mean when you refer to MODx. The actual file of the mod or the program MODx? Also with the extension changes do i have to change the extensions on the files themselves in order for the extensions to be loaded if so what is the reasoning in changing the extensions. I will try and do the changes and report back if i still get a error.
The MODx is the description of how to implement the MOD.

NO you don't have to physically change any extensions on files.
Look at the changes I highlighted above as ones you have possibly missed and let us know how you get on.
Darkness568
Registered User
Posts: 55
Joined: Sun Apr 13, 2008 11:24 pm
Contact:

Re: SEO MOD

Post by Darkness568 »

Just curious with this mod is it possible to make it so it doesnt have the near random numbers like t-34 and all that and just have the name and title there?
Locked

Return to “[3.0.x] MOD Database Releases”