Date: 08/15/00
- Next message: Gary Smith: "[PHP-DEV] Redirect new menu to another frame"
- Previous message: bowo <email protected>: "[PHP-DEV] 小日本网站被黑,中国人不可不看!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 6156
User Update by: tite <email protected>
Status: Feedback
Bug Type: Other
Description: Object loosing an array property
I guess you mean an explanation of the algorith with code explanations. If it is not enough... just tell me.
func_plant starts at motor_plantilla, where $planti is the file name of our template. It creates a new instance of bucle and fills out some properties. Once done this, it calls lector_plantilla, that is supposed to read that file contained now in $Plantilla which is a global variable.
lector_plantilla will read that file and fill the instance of bucle that recieves with every line of the fille (property lineas). Before asigning it to the object, the line is parsed callin parser().
parser() will return untouched the lines that have no template tags (this means text contained between @% and %@). Our tags contains @%command:params% <email protected> If it finds a tag, it will call the function asigned in $parser_func for that command with 2 params, the object bucle and the params that the tag had.
in datos_db() and load_img() the array property of the bucle object gets filled with the values in params. $params contains table_name.field_name. As you can see by the salida() function, the object got filled propperly :
salida("a馻dido $tabla $campo en while de ".$oBucle->tabla."<bR>\n");
salida("resultao[0][0] = ".$oBucle->tablas[0][0]."<BR>\n");
salida("ya tenemos ".sizeof($oBucle->tablas)." tablas <BR>\n");
output:
a馻dido Maestro_respuestas nombre en while de Preguntas
resultao[0][0] = Preguntas
ya tenemos 2 tablas
So, the object gets filled propperly. Once done this, it returns same thing with a w in front. The sense of doing this, is to have all field names and tables whenever the function scanner() is called, so this function will make a query to the mysql with those fields on the select part.
in do_where() a new instance of bucle is created hanging from the current instance. This new instance is linked to the parent instance through the propperty bucle->padre. Once done this, the lector_plantilla() is called up again so the lines contained between this @%where:...%@ and the following @%end-where:...%@ are assigned to this new instance of bucle. After this is done, the string @%wwhere:...%@ is returned to be assigned as a new line of the father instance so when scanner gets to it knows that it has to jump to a son instance and keep on parsing the son's lines before finishing these lines.
scanner() will go over all the memory nested of instances of bucle (after doing the query with the fields contained in bucle->tablas) and re-parse it. The different thing this time is that the tags (@% %@) will be replaced by the value in the DB that corresponds to it.
wdo_where() is called when the parser detects a wdb: tag. This function has to call scanner with the next son instance, so those lines get parsed before the lines from the actual instance gets parsed.
My problem is that when scanner() is called this second time from wdo_where() with the son's instance. The son's instance lost the array property tablas, but it didnt loose any other propperty value.
I don磘 know if this explanation satisfied your request, I hope so. If there are still doubts, contact me.
Thank you in advance.
Josafat Moragrega Fernandez
Full Bug description available at: http://bugs.php.net/?id=6156
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Gary Smith: "[PHP-DEV] Redirect new menu to another frame"
- Previous message: bowo <email protected>: "[PHP-DEV] 小日本网站被黑,中国人不可不看!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

