Jump to content
MakeWebGames

Recommended Posts

Posted

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\)/","&#153;");
$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>
Posted

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>';
Posted

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;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...