tinyMCE

Hi,

This is kind of PHP, but the plugin is Javascript so added it here too!

I am trying to create an external image list using TinyMCE. My code is as follows:

<script language="javascript" type="text/javascript" >
var tinyMCEImageList = new Array(
	// Name, URL
	
);
</script>
<?  
$trenn = ","; 
echo 'var tinyMCEImageList = new Array( 
'; 
include "library/config.php";
include "library/opendb.php"; 

	$query   = "SELECT id, title, name, type, size, content FROM images";
	$result  = mysql_query($query) or die('Error, query failed');
if ($result) 
{ 
while ($r = mysql_fetch_array($result)) 

	{ 
$link = $r["id"]; 
$name = $r["title"]; 
echo '["'.$name.'", "viewimage.php?id='.$link.'"]'; 
echo $trenn; 
} 
} 
echo "",""; 
echo ');'; 

	include 'library/closedb.php';	
	exit;


		
?>

This creates an array as follows:
var tinyMCEImageList = new Array( [“a title”, “viewimage.php?id=5”],[“wallpaper 5”, “viewimage.php?id=6”],[“vvbksdvbjkdfb”, “viewimage.php?id=7”],);

But when I open the add image bit no menu displays. There is a comma after the last file which i think might be the problem, but can’t seem to get rid of it.

If anyone can help it would be great!

Thanks
Phil