FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » hey guys, any seo urls plugins?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: hey guys, any seo urls plugins? [message #162597 is a reply to message #162577] Tue, 15 June 2010 19:52 Go to previous messageGo to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma:
Senior Member
I ended up doing this and put it in thread.php.t and index.php.t (Guess it could have been put in some other file that is included in both those, but I am a worthless coder, so I dont care):
/* begin URL SEO HACK */
		$forum_title_SEO = str_replace(" ","-",$r[10]);
		$forum_title_SEO = strtolower($forum_title_SEO);
		$forum_title_SEO = preg_replace('/[^a-z0-9_]/i', '-', $forum_title_SEO);
		$forum_title_SEO = preg_replace('/_[_]*/i', '-', $forum_title_SEO);
		$forum_title_SEO = str_replace('---', '-', $forum_title_SEO);
		$forum_title_SEO = str_replace('--', '-', $forum_title_SEO);
		$forum_title_SEO = str_replace('-s-', 's-', $forum_title_SEO);
		$forum_title_SEO = str_replace("%","",$forum_title_SEO);
		$forum_title_SEO = str_replace("/","",$forum_title_SEO);


There is also a problem if the thread title starts with numbers, so I also had to edit users.inc.t:
We just add an isnumeric check (should have been there from the start imo!)

			case 't': /* view thread */
				$_GET['t'] = 0;
				$_GET['th'] = $p[1];
				if (isset($p[2])&&is_numeric($p[2])) {
					$_GET['start'] = $p[2];
					if (!empty($p[3])) {
						$_GET[$p[3]] = 1;
					}
				}
				break;

switch ($p[0]) {
			case 'm': /* goto specific message */
				$_GET['t'] = 0;
				$_GET['goto'] = $p[1];
				if (isset($p[2])) {
					$_GET['th'] = $p[2];
					if (isset($p[3])&&is_numeric($p[3])) {
						$_GET['start'] = $p[3];
						if (is_numeric($p[3])) {
							$_GET['t'] = 'msg';
							unset($_GET['goto']);
						}



or well, for correctness sake, everywhere where it checks for stuff that's supposed to be only numbers Razz - This way, things will not get messed up if a thread is called "12 monkeys"


[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: set post image to accept it
Next Topic: Not getting any emails from FUDforum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 22:28:08 GMT 2024

Total time taken to generate the page: 0.03994 seconds