RedZone Posted July 1, 2009 Posted July 1, 2009 Hey, I have bbcode working good on my profiles I just can't get them to work on my gang profiles... I used the SAME thing just changed the SQL pull info.. It stops loading after $gangdata['gangDESC']=$bbc->bbcode_parse($gangdata['gangDESC']); I don't know why it won't process the bbcode. First half of my gang page.. <?php class bbcode { var $engine=""; function bbcode() { require "bbcode_engine.php"; $this->engine= new bbcode_engine; $this->engine->cust_tag("/</","<"); $this->engine->cust_tag("/>/",">"); //Since \n and screw up preg, convert them out. $this->engine->cust_tag("/\n/","&nbrlb;"); $this->engine->simple_bbcode_tag("b"); $this->engine->simple_bbcode_tag("i"); $this->engine->simple_bbcode_tag("u"); $this->engine->simple_bbcode_tag("s"); $this->engine->simple_bbcode_tag("sub"); $this->engine->simple_bbcode_tag("sup"); $this->engine->simple_bbcode_tag("big"); $this->engine->simple_bbcode_tag("small"); $this->engine->adv_bbcode_tag("list","ul"); $this->engine->adv_bbcode_tag("olist","ol"); $this->engine->adv_bbcode_tag("item","li"); $this->engine->adv_option_tag("font","font","family"); $this->engine->adv_option_tag("size","font","size"); $this->engine->adv_option_tag("url","a","href"); $this->engine->adv_option_tag("color","font","color"); $this->engine->adv_option_tag("style","span","style"); $this->engine->simp_option_notext("img","src"); $this->engine->simp_bbcode_att("img","src"); $this->engine->cust_tag("/\(c\)/","©"); $this->engine->cust_tag("/\(tm\)/","™"); $this->engine->cust_tag("/\(r\)/","®"); $this->engine->adv_option_tag_em("email","a","href"); $this->engine->adv_bbcode_att_em("email","a","href"); $this->engine->cust_tag("/\[youtube\](.+?)\[\/youtube\]/","<object width='425' height='344'><param name='movie' value='http://www.youtube.com/v/\\1'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/\\1' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='425' height='344'></embed></object>"); $this->engine->cust_tag("/\[left\](.+?)\[\/left\]/","<div align='left'>\\1</div>"); $this->engine->cust_tag("/\[center\](.+?)\[\/center\]/","<div align='center'>\\1</div>"); $this->engine->cust_tag("/\[right\](.+?)\[\/right\]/","<div align='right'>\\1</div>"); $this->engine->cust_tag("/\[quote="(.+?)\"](.+?)\[\/quote\]/","<div class='quotetop'>QUOTE(\\1)</div><div class='quotemain'>\\2</div>"); $this->engine->cust_tag("/\[quote\](.+?)\[\/quote\]/","<div class='quotetop'>QUOTE</div><div class='quotemain'>\\1</div>"); $this->engine->cust_tag("/\[code\](.+?)\[\/code\]/","<div class='codetop'>CODE</div><div class='codemain'><code>\\1</code></div>"); $this->engine->cust_tag("/\[codebox\](.+?)\[\/codebox\]/","<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>\\1</div>"); $this->engine->cust_tag("/&nbrlb;/"," \n"); } function bbcode_parse($html) { return $this->engine->parse_bbcode($html); } } include "globals.php"; $bbc = new bbcode; $_GET['ID'] = abs((int) $_GET['ID']); if(!$_GET['ID']) { print "Invalid use of file"; } else { $gq=$db->query("SELECT * FROM gangs WHERE gangID={$_GET['ID']}"); $gangdata=$db->fetch_row($gq); switch($_GET['action']) { case 'view': gang_view(); break; case 'userlist': gang_userlist(); break; case 'apply': gang_applyform(); break; case 'applys': gang_applysubmit(); break; } } function gang_view() { global $db,$ir,$c,$h,$gangdata; print " <h3>{$gangdata['gangNAME']}</h3><table bgcolor='black' style='width: 100%; border: 1px solid #282828;'> <tr>"; $gangdata['gangDESC']=$bbc->bbcode_parse($gangdata['gangDESC']); print "<td colspan='6'>{$gangdata['gangDESC']} </td> </tr> Quote
Spudinski Posted July 2, 2009 Posted July 2, 2009 Re: bbcode problem Why don't you just print out trough the bccode_parse() function? ..so then this print "<td colspan='6'>{$gangdata['gangDESC']} </td>"; ..will become this echo 'td colspan="6">' . $bbc->bbcode_parse($gangdata['gangDESC']) . '</td>'; Quote
Magictallguy Posted July 2, 2009 Posted July 2, 2009 Re: bbcode problem You haven't globally defined the $bbc variable.. Find function gang_view() { global $db,$ir,$c,$h,$gangdata; and change to function gang_view() { global $db, $ir, $c, $h, $gangdata, $bbc; Quote
RedZone Posted July 2, 2009 Author Posted July 2, 2009 Re: bbcode problem I used both of ur guys code.. Even fix his "<" boo boo. :roll: Now it just shows a white page? :-o Quote
RedZone Posted July 2, 2009 Author Posted July 2, 2009 Re: bbcode problem NVM! I fixed it! haha. it was my boo boo :lol: Quote
CrazyT Posted July 2, 2009 Posted July 2, 2009 Re: bbcode problem NVM! I fixed it! haha. it was my boo boo :lol: Wasn't hard was it?.. just needed to global $bbc; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.