BB codes not working right

Forum
Last Post
Threads / Messages

keliptis

Member
Member
Joined
May 6, 2011
Messages
15
Points
0
Mysidian Dollar
0
So ive been bothered by this for a while and I cant seem to find the issue.

When I edited text in the index page only some bb codes work, bold, underline so forth

However color and size ones wont, they exist in bbcode.php and says it should convert them however for some reason it is not.

Heres bbcode.php

Code:
<?php

// This file parses BBCode for user editable pages
// Thanks to TheMagnitude for this code and for sharing
// BBcodes mod credit to Teshia

function bbconvert($text)
{
        // CONVERT ALL HTML SPECIAL CHARS TO THERE ENTITIES
        $text = htmlentities($text, ENT_QUOTES);
        
        // PARSE BB CODE
        $text = preg_replace('|\[b\](.+?)\[\/b\]|i', '<strong>$1</strong>', $text);
        $text = preg_replace('|\[i\](.+?)\[\/i\]|i', '<em>$1</em>', $text);
        $text = preg_replace('|\[u\](.+?)\[\/u\]|i', '<u>$1</u>', $text);
        $text = preg_replace('|\[img\](.+?)\[\/img\]|i', '<img src="$1" border="0">', $text);
        $text = preg_replace('|\[url=(.+?)\](.+?)\[\/url\]|i', '<a href="$1" target="_blank">$2</a>', $text);
        $text = preg_replace('|\[color=(.+?[^;])\](.+?)\[\/color\]|i', '<span style="color:$1;">$2</span>', $text);
        $text = preg_replace('|\[size=(.+?[^;])\](.+?)\[\/size\]|i', '<span style="font-size:$1;">$2</span>', $text);
        $text = preg_replace('|\[left\](.+?)\[\/left\]|i', '<span style="text-align: left;">$1</span>', $text);
        $text = preg_replace('|\[right\](.+?)\[\/right\]|i', '<span style="text-align: right;">$1</span>', $text);
        $text = preg_replace('|\[center\](.+?)\[\/center\]|i', '<center>$1</center>', $text);
	    $text = preg_replace('|\[urlsame=(.+?)\](.+?)\[\/urlsame\]|i', '<a href="$1" target="_self">$2</a>', $text);
        $text = preg_replace('|\[s\](.+?)\[\/s\]|i', '<del>$1</del>', $text);
        $text = preg_replace('|\[url\](.+?)\[\/url\]|i', '<a href="$1" target="_blank">$1</a>', $text);
        $text = preg_replace('|\:hr\:|i', '<hr>', $text);
		$text = preg_replace('|\[youtube\](.+?)\[\/youtube\]|i', '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', $text);
        $text = preg_replace('|\[profile\](.+?)\[\/profile\]|i', '<a href="profile.php?user=$1">$1</a>', $text);
        $text = preg_replace('|\[imgmap\](.+?)\[\/imgmap\]|i', '<img src="$1" border="0" usemap="#map1">', $text);
        $text = preg_replace('|\[map\]|i', '<map name="map1">', $text);
        $text = preg_replace('|\[\/map\]|i', '</map>', $text);
        $text = preg_replace('|\[where=(.+?)\,(.+?)\,(.+?)\,(.+?)=(.+?)\]|i', '<area shape="rect" coords="$1,$2,$3,$4" href="$5">', $text);
        $text = preg_replace('|\[wherecirc=(.+?)\,(.+?)\,(.+?)\=(.+?)\]|i', '<area shape="circle" coords="$1,$2,$3" href="$4">', $text);

	  // RETURN HTML RESULT
        return $text;
}

?>
 
Nvm I sorted at least the color some codes didn't work with others im guessing and voided all of them
 
Well actually starting from Mys v1.3.0 we will be using this WYSIWYG text editor, the BBcodes will no longer be needed. But if you insist on using Bbcodes and they wont work for you, lemme know and I will see what I can do to help you.
 
Ive got most to work took some work goggling to figure out size ive noticed some bb codes dont work with others it just voids them so

I had that issue before I just never solved why but trial and error seems to show some dont work with others
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,280
Messages
33,130
Members
1,603
Latest member
Monako
BETA

Latest Threads

Top