Hello,
This is driving me nuts!
I have a php file which retrieves some values from a mysql database and stores them in an array (starray with fields product,item_id). Then I loop through the array and pass the values to a class which further processes them and echos them out to be used as the source for an explorer style menu script.
The arrays are populated fine when there is only a limited return, but I have some results where there are 500 records, on these the arrays invariably get corrupted,and the javascript pukes. It also seems somewhat dependant on the overall size of the javascript.
Does anyone have clues here? Is there a major size restriction on either php or javascript arrays, or simply on the size of the html/javascript or is this perhaps just a data corruption?
Thanks for any help! I have spent far too long on this!
Example of the script looping through the db array and passing to an class:
$node1 = $tree->add_folder ($root, "Content Manager", "contentindex.php", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif");
$tree->add_document ($node1, "Create New", "contentdetails.php","mixed/draw.gif");
$node1_itm = $tree->add_folder ($node1, "Content", "contentindex.php", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif");
while(list($product,$item_id) = each($ciArray)) {
$node1_details = $tree->add_folder ($node1_itm, "$product", "contentdetails.php?item_id=$item_id", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif");
$tree->add_document ($node1_details, "Details", "contentdetails.php?item_id=$item_id","mixed/document.gif");
$tree->add_document ($node1_details, "Images", "contentimages.php?item_id=$item_id","mixed/document.gif");
}
Function which echoes the javascipt population data:
function add_folder ($t_parent, $t_text, $t_url,
$t_imgopen = "", $t_imgclosed = "")
{
$jsvn = "aux".$this->tree_count;
$this->tree_count++;
if (!strlen($t_imgopen))
$t_imgopen = $this->tree_ftv2folderopen;
if (!strlen($t_imgclosed))
$t_imgclosed = $this->tree_ftv2folderclosed;
echo "$jsvn = insFld($t_parent, gFld (\"$t_text\", ";
echo "\"$t_url\", \"$t_imgopen\", \"$t_imgclosed\"));\n";
return ($jsvn);
}
function add_document ($t_parent, $t_text, $t_url, $t_img = "")
{
if (!strlen($t_img)) $t_img = $this->tree_ftv2doc;
echo "insDoc($t_parent, gLnk ($t_parent, \"$t_text\", ";
echo "\"$t_url\", \"$t_img\"));\n";
}
Example of corrupted data: (Look at AUX74):
insDoc(aux73, gLnk (aux73, "Details", "storedetails.php?item_id=314", "ftv2/ftv2doc.gif"));
insDoc(aux73, gLnk (aux73, "Images", "storeimages.php?item_id=314", "mixed/document.gif"));
insDoc(aux73, gLnk (aux73, "Commerce", "storecommerce.php?item_id=314", "mixed/document.gif"));
aux74 = insFld(aux24, gFld ("120178", "storedet22, "Images .õ€contentimages.php?item_id=882", "mixed/document.gif"));
aux23 = insFld(foldersTree, gFld ("Catalog Manager", "/", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif"));
insDoc(aux23, gLnk (aux23, "Create New", "storedetails.php/", "mixed/draw.gif"));
aux24 = insFld(aux23, gFld ("Items", "storeindex.php", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif"));
aux25 = insFld(aux24, gFld ("6006LSS 01", "storedetails.php?item_id=749", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif"));
and another corrupt line:
aux34 = instem_id=323", "ftv2/ftv2folderclosed.gif", "ftv2/ftv2folderopen.gif"));
This is a script based on one obtained from posi.de and http://www.mmartins.com/ft/