Jump to content

Problem with my own bbcode


RockyLouZ

Recommended Posts

To start off here is my code...

 

<?

require_once("classes.php");
require_once("dbcon.php");


function displayInfo($the_userid)
{
	$Duser = new User($the_userid);

	$the_info = "
			<br>
			$Duser->formattedname ($the_userid) $Duser->cityname $Duser->formattedonline
			<br>
		";

	return $the_info;

}

$text = "Results for player [user]566[/user]";
$text = eregi_replace("\\[user]([^\\[]*)\\[/user\\]"," ". displayInfo("\\1") ." ",$text);

echo"$text";

?>

 

The problem is that when I am passing the variable \\1, it echos it correctly with the variable "$the_userid" which is 566.

But when I use a query to select the information, or use a class to define the user, it treats the variable as one.

$Duser->formattedname ($the_userid) $Duser->cityname $Duser->formattedonline  All the info that I echo with the class Duser is selecting info from the user with an id of one.  But the ($the_userid) displays as 566.  Ive tried using $the_userid = (int)$the_userid but it sets the userid to 0 then.  Ive worked on this for hours and can't seem to find out what the dang problem is.  I'm sure it's something minor, there can't be much more to it.  I also need to use the eregi_replace function to replace all instances of [user].  If anyone can help me out it would be greatly appreciated.

 

Thanks!

Lou

Link to comment
https://forums.phpfreaks.com/topic/173541-problem-with-my-own-bbcode/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.